TestData
2 years ago
BasicTest.php
5 years ago
CallTest.php
5 years ago
ChainTest.php
5 years ago
ConstructParamsTest.php
5 years ago
CreateArgsTest.php
5 years ago
DiceTest.php
5 years ago
NamedInstancesTest.php
5 years ago
NamespaceTest.php
5 years ago
ShareInstancesTest.php
2 years ago
SubstitutionsTest.php
5 years ago
bootstrap.php
5 years ago
DiceTest.php
40 lines
| 1 | <?php |
| 2 | /* @description Dice - A minimal Dependency Injection Container for PHP * |
| 3 | * @author Tom Butler tom@r.je * |
| 4 | * @copyright 2012-2018 Tom Butler <tom@r.je> | https:// r.je/dice.html * |
| 5 | * @license http:// www.opensource.org/licenses/bsd-license.php BSD License * |
| 6 | * @version 3.0 */ |
| 7 | abstract class DiceTest extends \PHPUnit\Framework\TestCase { |
| 8 | protected $dice; |
| 9 | |
| 10 | public function __construct() { |
| 11 | parent::__construct(); |
| 12 | // spl_autoload_register(array($this, 'autoload')); |
| 13 | |
| 14 | //Load the test classes for this test |
| 15 | $name = str_replace('Test', '', get_class($this)); |
| 16 | require_once 'tests/TestData/Basic.php'; |
| 17 | |
| 18 | if (file_exists('tests/TestData/' . $name . '.php')) { |
| 19 | require_once 'tests/TestData/' . $name . '.php'; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | public function autoload($class) { |
| 24 | //If Dice Triggers the autoloader the test fails |
| 25 | //This generally means something invalid has been passed to |
| 26 | //a method such as is_subclass_of or dice is trying to construct |
| 27 | //an object from something it shouldn't. |
| 28 | $this->fail('Autoload triggered: ' . $class); |
| 29 | } |
| 30 | |
| 31 | protected function setUp(): void { |
| 32 | parent::setUp (); |
| 33 | $this->dice = new \Dice\Dice(); |
| 34 | } |
| 35 | |
| 36 | protected function tearDown(): void { |
| 37 | $this->dice = null; |
| 38 | parent::tearDown (); |
| 39 | } |
| 40 | } |