Fixed class call in unit tests

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
Gregory PLANCHAT 2012-07-12 19:55:44 +02:00
commit 6b393762d9

View file

@ -32,19 +32,11 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
{ {
$this->_app = $this->getMock('Wootook\\Core\\App\\App', array('__construct'), array('')); $this->_app = $this->getMock('Wootook\\Core\\App\\App', array('__construct'), array(''));
$this->_registry = new \Wootook\Core\DependencyInjection\Registry($this->_app); $this->_registry = new \Wootook\Core\DependencyInjection\Registry($this->_app);
$this->_config = new \Wootook\Core\Config\Node(array(
'Test\\Foo' => array(
'app' => array('instance' => $this->_app),
'std-class' => array('registry' => 'registry-stored-instance')
),
'Test\\Bar' => null,
'Test\\Baz' => null
));
} }
public function testGetRegistryWhilePassedToConstructor() public function testGetRegistryWhilePassedToConstructor()
{ {
$object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_config, $this->_registry); $object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_registry);
$this->assertAttributeSame($this->_registry, '_registry', $object); $this->assertAttributeSame($this->_registry, '_registry', $object);
$this->assertSame($object->getRegistry(), $this->_registry); $this->assertSame($object->getRegistry(), $this->_registry);
@ -52,7 +44,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
public function testGetRegistryWhileNonePassedToConstructor() public function testGetRegistryWhileNonePassedToConstructor()
{ {
$object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_config); $object = new \Wootook\Core\DependencyInjection\Factory($this->_app);
$this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Registry', $object->getRegistry()); $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Registry', $object->getRegistry());
$this->assertAttributeNotEmpty('_registry', $object); $this->assertAttributeNotEmpty('_registry', $object);
@ -66,8 +58,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
public function testGetDefinition() public function testGetDefinition()
{ {
$object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_config, $this->_registry); $object = new \Wootook\Core\DependencyInjection\Factory($this->_app, $this->_registry);
$this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Definition', $object->getDefinition('Test\\Foo')); $this->assertInstanceOf('Wootook\\Core\\DependencyInjection\\Definition\\ClassDefinition', $object->getClassDefinition('stdClass'));
} }
} }