Skip to content

Commit

Permalink
#53 Removed useless/duplicate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Apr 7, 2013
1 parent 23f19fe commit dd4de2a
Show file tree
Hide file tree
Showing 16 changed files with 10 additions and 430 deletions.
25 changes: 0 additions & 25 deletions tests/IntegrationTests/DI/ConstructorInjectionTest.php
Expand Up @@ -22,31 +22,6 @@ public function setUp()
{
// Reset the singleton instance to ensure all tests are independent
Container::reset();
$container = Container::getInstance();
$container->getConfiguration()->addDefinitions(
array(
'IntegrationTests\DI\Fixtures\ConstructorInjectionTest\Interface1' => array(
'class' => 'IntegrationTests\DI\Fixtures\ConstructorInjectionTest\Class3',
)
)
);
}

public function testBasicInjection()
{
/** @var $class1 Class1 */
$class1 = Container::getInstance()->get('IntegrationTests\DI\Fixtures\ConstructorInjectionTest\Class1');
$dependency = $class1->getDependency();
$this->assertInstanceOf('IntegrationTests\DI\Fixtures\ConstructorInjectionTest\Class2', $dependency);
}

public function testInterfaceInjection()
{
/** @var $class1 Class1 */
$class1 = Container::getInstance()->get('IntegrationTests\DI\Fixtures\ConstructorInjectionTest\Class1');
$dependency = $class1->getInterface1();
$this->assertInstanceOf('IntegrationTests\DI\Fixtures\ConstructorInjectionTest\Interface1', $dependency);
$this->assertInstanceOf('IntegrationTests\DI\Fixtures\ConstructorInjectionTest\Class3', $dependency);
}

/**
Expand Down
Expand Up @@ -9,30 +9,15 @@

namespace IntegrationTests\DI\Fixtures\ConstructorInjectionTest;

use IntegrationTests\DI\Fixtures\ConstructorInjectionTest\Class2;

/**
* Fixture class
*/
class Buggy1
{

/**
* @var Class2
*/
private $dependency;

public function __construct($dependency)
{
$this->dependency = $dependency;
}

/**
* @return Class2
*/
public function getDependency()
{
return $this->dependency;
}

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions tests/IntegrationTests/DI/Fixtures/SetterInjectionTest/Buggy1.php
Expand Up @@ -10,19 +10,13 @@
namespace IntegrationTests\DI\Fixtures\SetterInjectionTest;

use DI\Annotation\Inject;
use IntegrationTests\DI\Fixtures\SetterInjectionTest\Class2;

/**
* Fixture class
*/
class Buggy1
{

/**
* @var Class2
*/
private $dependency;

/**
* @Inject
* @param $dependency
Expand All @@ -32,12 +26,4 @@ public function setDependency($dependency)
$this->dependency = $dependency;
}

/**
* @return Class2
*/
public function getDependency()
{
return $this->dependency;
}

}
64 changes: 0 additions & 64 deletions tests/IntegrationTests/DI/Fixtures/SetterInjectionTest/Class1.php

This file was deleted.

This file was deleted.

Expand Up @@ -20,11 +20,6 @@ class NamedInjectionClass
/**
* @Inject(name="namedDependency")
*/
private $dependency;

public function getDependency()
{
return $this->dependency;
}
public $dependency;

}
Expand Up @@ -21,14 +21,6 @@ class ValueInjectionClass
* @Inject("db.host")
* @var string
*/
private $value;

/**
* @return string
*/
public function getValue()
{
return $this->value;
}
public $value;

}
8 changes: 1 addition & 7 deletions tests/IntegrationTests/DI/PreConstructorInjectionTest.php
Expand Up @@ -18,15 +18,9 @@
class PreConstructorInjectionInjectionTest extends \PHPUnit_Framework_TestCase
{

public function setUp()
{
// Reset the singleton instance to ensure all tests are independent
Container::reset();
}

public function testDependenciesAreInjectedBeforeConstructorIsCalled()
{
$container = Container::getInstance();
$container = new Container();
/** @var $class1 Class1 */
$class1 = $container->get('IntegrationTests\DI\Fixtures\PreConstructorInjection\Class1');
$this->assertTrue($class1->dependencyInjected);
Expand Down

0 comments on commit dd4de2a

Please sign in to comment.