PHP Class PhpSpec\ObjectBehavior

Most specs will extend this class directly. Its responsibility is to proxy method calls to PhpSpec caller which will wrap the results into PhpSpec subjects. This results will then be able to be matched against expectations.
Inheritance: implements ArrayAcces\ArrayAccess, implements PhpSpec\Matcher\MatchersProvider, implements PhpSpec\Wrapper\SubjectContainer, implements PhpSpec\Wrapper\ObjectWrapper, implements Specification
ファイルを表示 Open project: phpspec/phpspec Class Usage Examples

Protected Properties

Property Type Description
$object PhpSpec\Wrapper\Subject

Public Methods

Method Description
__call ( string $method, array $arguments = [] ) : mixed Proxies all calls to the PhpSpec subject
__get ( string $property ) : mixed Proxies getting to the PhpSpec subject
__invoke ( ) : mixed Proxies functor calls to PhpSpec subject
__set ( string $property, mixed $value ) Proxies setting to the PhpSpec subject
getMatchers ( ) : array Override this method to provide your own inline matchers
getWrappedObject ( ) : object Gets the unwrapped proxied object from PhpSpec subject
offsetExists ( string | integer $key ) : Subject Checks if a key exists in case object implements ArrayAccess
offsetGet ( string | integer $key ) : Subject Gets the value in a particular position in the ArrayAccess object
offsetSet ( string | integer $key, mixed $value ) Sets the value in a particular position in the ArrayAccess object
offsetUnset ( string | integer $key ) Unsets a position in the ArrayAccess object
setSpecificationSubject ( Subject $subject ) Used by { @link PhpSpec\Runner\Maintainer\SubjectMaintainer::prepare() } to prepare the subject with all the needed collaborators for proxying object behaviour

Method Details

__call() public method

Proxies all calls to the PhpSpec subject
public __call ( string $method, array $arguments = [] ) : mixed
$method string
$arguments array
return mixed

__get() public method

Proxies getting to the PhpSpec subject
public __get ( string $property ) : mixed
$property string
return mixed

__invoke() public method

Proxies functor calls to PhpSpec subject
public __invoke ( ) : mixed
return mixed

__set() public method

Proxies setting to the PhpSpec subject
public __set ( string $property, mixed $value )
$property string
$value mixed

getMatchers() public method

Override this method to provide your own inline matchers
public getMatchers ( ) : array
return array a list of inline matchers

getWrappedObject() public method

Gets the unwrapped proxied object from PhpSpec subject
public getWrappedObject ( ) : object
return object

offsetExists() public method

Checks if a key exists in case object implements ArrayAccess
public offsetExists ( string | integer $key ) : Subject
$key string | integer
return PhpSpec\Wrapper\Subject

offsetGet() public method

Gets the value in a particular position in the ArrayAccess object
public offsetGet ( string | integer $key ) : Subject
$key string | integer
return PhpSpec\Wrapper\Subject

offsetSet() public method

Sets the value in a particular position in the ArrayAccess object
public offsetSet ( string | integer $key, mixed $value )
$key string | integer
$value mixed

offsetUnset() public method

Unsets a position in the ArrayAccess object
public offsetUnset ( string | integer $key )
$key string | integer

setSpecificationSubject() public method

Used by { @link PhpSpec\Runner\Maintainer\SubjectMaintainer::prepare() } to prepare the subject with all the needed collaborators for proxying object behaviour
public setSpecificationSubject ( Subject $subject )
$subject PhpSpec\Wrapper\Subject

Property Details

$object protected_oe property

protected Subject,PhpSpec\Wrapper $object
return PhpSpec\Wrapper\Subject