Skip to content

Commit

Permalink
Use Chicken and Egg instead of C and D
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Jun 14, 2019
1 parent 8adf2c4 commit 34549b1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 34 deletions.
14 changes: 0 additions & 14 deletions tests/support/C.php

This file was deleted.

14 changes: 0 additions & 14 deletions tests/support/D.php

This file was deleted.

9 changes: 9 additions & 0 deletions tests/support/cycle/Chicken.php
@@ -0,0 +1,9 @@
<?php
namespace yii\di\tests\support\cycle;

class Chicken
{
public function __construct(Egg $egg)
{
}
}
9 changes: 9 additions & 0 deletions tests/support/cycle/Egg.php
@@ -0,0 +1,9 @@
<?php
namespace yii\di\tests\support\cycle;

class Egg
{
public function __construct(Chicken $chicken)
{
}
}
11 changes: 5 additions & 6 deletions tests/unit/ContainerTest.php
Expand Up @@ -12,16 +12,15 @@
use yii\di\Reference;
use yii\di\tests\support\A;
use yii\di\tests\support\B;
use yii\di\tests\support\C;
use yii\di\tests\support\Car;
use yii\di\tests\support\CarFactory;
use yii\di\tests\support\ColorPink;
use yii\di\tests\support\ConstructorTestClass;
use yii\di\tests\support\D;
use yii\di\tests\support\cycle\Chicken;
use yii\di\tests\support\cycle\Egg;
use yii\di\tests\support\EngineInterface;
use yii\di\tests\support\EngineMarkOne;
use yii\di\tests\support\EngineMarkTwo;
use yii\di\tests\support\GearBox;
use yii\di\tests\support\InvokeableCarFactory;
use yii\di\tests\support\MethodTestClass;
use yii\di\tests\support\PropertyTestClass;
Expand Down Expand Up @@ -67,10 +66,10 @@ public function testOptionalCircularClassDependency(): void
public function testCircularClassDependency(): void
{
$container = new Container();
$container->set(C::class, C::class);
$container->set(D::class, D::class);
$container->set(Chicken::class, Chicken::class);
$container->set(Egg::class, Egg::class);
$this->expectException(CircularReferenceException::class);
$container->get(C::class);
$container->get(Chicken::class);
}

public function testClassSimple(): void
Expand Down

0 comments on commit 34549b1

Please sign in to comment.