PhpSpec\Wrapper\Wrapper::wrap PHP Method

wrap() public method

public wrap ( object $value = null ) : Subject
$value object
return Subject
    public function wrap($value = null)
    {
        $wrappedObject = new WrappedObject($value, $this->presenter);
        $caller = $this->createCaller($wrappedObject);
        $arrayAccess = new SubjectWithArrayAccess($caller, $this->presenter, $this->dispatcher);
        $expectationFactory = new ExpectationFactory($this->example, $this->dispatcher, $this->matchers);
        return new Subject($value, $this, $wrappedObject, $caller, $arrayAccess, $expectationFactory);
    }

Usage Example

Example #1
0
 /**
  * @param ExampleNode            $example
  * @param Specification $context
  * @param MatcherManager         $matchers
  * @param CollaboratorManager    $collaborators
  */
 public function prepare(ExampleNode $example, Specification $context, MatcherManager $matchers, CollaboratorManager $collaborators)
 {
     $subjectFactory = new Wrapper($matchers, $this->presenter, $this->dispatcher, $example, $this->accessInspector);
     $subject = $subjectFactory->wrap(null);
     $subject->beAnInstanceOf($example->getSpecification()->getResource()->getSrcClassname());
     $context->setSpecificationSubject($subject);
 }
All Usage Examples Of PhpSpec\Wrapper\Wrapper::wrap