Nelmio\Alice\Definition\Object\SimpleObject::getInstance PHP Method

getInstance() public method

public getInstance ( )
    public function getInstance()
    {
        return $this->instance;
    }

Usage Example

Beispiel #1
0
 public function testIsNotImmutable()
 {
     $reference = 'user0';
     $instance = new \stdClass();
     $object = new SimpleObject($reference, $instance);
     // Mutate injected values
     $instance->foo = 'bar';
     // Mutate returned values
     $object->getInstance()->ping = 'pong';
     $expected = StdClassFactory::create(['foo' => 'bar', 'ping' => 'pong']);
     $actual = $object->getInstance();
     $this->assertEquals($expected, $actual);
 }