|
|
@ -11,9 +11,6 @@ use yii\test\Fixture; |
|
|
|
use yii\test\FixtureTrait; |
|
|
|
use yii\test\FixtureTrait; |
|
|
|
use yiiunit\TestCase; |
|
|
|
use yiiunit\TestCase; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @group fixture |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
class Fixture1 extends Fixture |
|
|
|
class Fixture1 extends Fixture |
|
|
|
{ |
|
|
|
{ |
|
|
|
public $depends = ['yiiunit\framework\test\Fixture2']; |
|
|
|
public $depends = ['yiiunit\framework\test\Fixture2']; |
|
|
@ -56,6 +53,35 @@ class Fixture3 extends Fixture |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Fixture4 extends Fixture |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
public $depends = ['yiiunit\framework\test\Fixture5']; |
|
|
|
|
|
|
|
public function load() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MyTestCase::$load .= '4'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function unload() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MyTestCase::$unload .= '4'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Fixture5 extends Fixture |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
public $depends = ['yiiunit\framework\test\Fixture4']; |
|
|
|
|
|
|
|
public function load() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MyTestCase::$load .= '5'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function unload() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MyTestCase::$unload .= '5'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MyTestCase |
|
|
|
class MyTestCase |
|
|
|
{ |
|
|
|
{ |
|
|
|
use FixtureTrait; |
|
|
|
use FixtureTrait; |
|
|
@ -104,16 +130,30 @@ class MyTestCase |
|
|
|
'fixture1' => Fixture1::className(), |
|
|
|
'fixture1' => Fixture1::className(), |
|
|
|
'fixture3' => Fixture3::className(), |
|
|
|
'fixture3' => Fixture3::className(), |
|
|
|
]; |
|
|
|
]; |
|
|
|
case 7: |
|
|
|
case 7: return [ |
|
|
|
default: return [ |
|
|
|
|
|
|
|
'fixture1' => Fixture1::className(), |
|
|
|
'fixture1' => Fixture1::className(), |
|
|
|
'fixture2' => Fixture2::className(), |
|
|
|
'fixture2' => Fixture2::className(), |
|
|
|
'fixture3' => Fixture3::className(), |
|
|
|
'fixture3' => Fixture3::className(), |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
case 8: return [ |
|
|
|
|
|
|
|
'fixture4' => Fixture4::className(), |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
case 9: return [ |
|
|
|
|
|
|
|
'fixture5' => Fixture5::className(), |
|
|
|
|
|
|
|
'fixture4' => Fixture4::className(), |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
case 10: return [ |
|
|
|
|
|
|
|
'fixture3a' => Fixture3::className(), // duplicate fixtures may occur two fixtures depend on the same fixture. |
|
|
|
|
|
|
|
'fixture3b' => Fixture3::className(), |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
default: return []; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @group fixture |
|
|
|
|
|
|
|
*/ |
|
|
|
class FixtureTest extends TestCase |
|
|
|
class FixtureTest extends TestCase |
|
|
|
{ |
|
|
|
{ |
|
|
|
public function testDependencies() |
|
|
|
public function testDependencies() |
|
|
@ -145,14 +185,16 @@ class FixtureTest extends TestCase |
|
|
|
protected function getDependencyTests() |
|
|
|
protected function getDependencyTests() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return [ |
|
|
|
return [ |
|
|
|
0 => ['fixture1' => false, 'fixture2' => false, 'fixture3' => false], |
|
|
|
0 => ['fixture1' => false, 'fixture2' => false, 'fixture3' => false, 'fixture4' => false, 'fixture5' => false], |
|
|
|
1 => ['fixture1' => true, 'fixture2' => false, 'fixture3' => false], |
|
|
|
1 => ['fixture1' => true, 'fixture2' => false, 'fixture3' => false, 'fixture4' => false, 'fixture5' => false], |
|
|
|
2 => ['fixture1' => false, 'fixture2' => true, 'fixture3' => false], |
|
|
|
2 => ['fixture1' => false, 'fixture2' => true, 'fixture3' => false, 'fixture4' => false, 'fixture5' => false], |
|
|
|
3 => ['fixture1' => false, 'fixture2' => false, 'fixture3' => true], |
|
|
|
3 => ['fixture1' => false, 'fixture2' => false, 'fixture3' => true, 'fixture4' => false, 'fixture5' => false], |
|
|
|
4 => ['fixture1' => true, 'fixture2' => true, 'fixture3' => false], |
|
|
|
4 => ['fixture1' => true, 'fixture2' => true, 'fixture3' => false, 'fixture4' => false, 'fixture5' => false], |
|
|
|
5 => ['fixture1' => false, 'fixture2' => true, 'fixture3' => true], |
|
|
|
5 => ['fixture1' => false, 'fixture2' => true, 'fixture3' => true, 'fixture4' => false, 'fixture5' => false], |
|
|
|
6 => ['fixture1' => true, 'fixture2' => false, 'fixture3' => true], |
|
|
|
6 => ['fixture1' => true, 'fixture2' => false, 'fixture3' => true, 'fixture4' => false, 'fixture5' => false], |
|
|
|
7 => ['fixture1' => true, 'fixture2' => true, 'fixture3' => true], |
|
|
|
7 => ['fixture1' => true, 'fixture2' => true, 'fixture3' => true, 'fixture4' => false, 'fixture5' => false], |
|
|
|
|
|
|
|
8 => ['fixture1' => false, 'fixture2' => false, 'fixture3' => false, 'fixture4' => true, 'fixture5' => false], |
|
|
|
|
|
|
|
9 => ['fixture1' => false, 'fixture2' => false, 'fixture3' => false, 'fixture4' => true, 'fixture5' => true], |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -167,6 +209,9 @@ class FixtureTest extends TestCase |
|
|
|
5 => ['32', '23'], |
|
|
|
5 => ['32', '23'], |
|
|
|
6 => ['321', '123'], |
|
|
|
6 => ['321', '123'], |
|
|
|
7 => ['321', '123'], |
|
|
|
7 => ['321', '123'], |
|
|
|
|
|
|
|
8 => ['54', '45'], |
|
|
|
|
|
|
|
9 => ['45', '54'], |
|
|
|
|
|
|
|
10 => ['3', '3'], |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|