phpspec - get return value
Asked Answered
U

1

5

I want to get the actual return value of the object rather than a chainable object.

class Foo
{
   public $attribute = 'data';
}

class FooSpec extends ObjectBehavior
{
   public function it_is_a_test()
   {
       $attribute = $this->attribute; // I want to get 'data'
   }
}

Is there any way for this to happen?

Thanks.

Unpractical answered 4/8, 2014 at 21:10 Comment(0)
U
10

Just in case anyone needs it

$attribute = $this->attribute->getWrappedObject();

It returns the actual return value of the function/attribute.

Unpractical answered 4/8, 2014 at 21:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.