Skip to content

Commit

Permalink
Adding test case to verify that cloned instances should be immutable/…
Browse files Browse the repository at this point in the history
…independent
  • Loading branch information
Ocramius committed Aug 14, 2014
1 parent 7547e2c commit 5fda717
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ public function testInstantiationFromNonExistingClass($invalidClassName)
$this->instantiator->instantiate($invalidClassName);
}

public function testInstancesAreNotCloned()
{
$className = 'TemporaryClass' . uniqid();

eval('namespace ' . __NAMESPACE__ . '; class ' . $className . '{}');

$instance = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className);

$instance->foo = 'bar';

$instance2 = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className);

$this->assertObjectNotHasAttribute('foo', $instance2);
}

/**
* Provides a list of instantiable classes (existing)
*
Expand Down

0 comments on commit 5fda717

Please sign in to comment.