drycart /
di
| 1 | <?php |
||
| 2 | /* |
||
| 3 | * @copyright (c) 2018 Mendel <[email protected]> |
||
| 4 | * @license see license.txt |
||
| 5 | */ |
||
| 6 | namespace drycart\di\tests; |
||
| 7 | use PHPUnit\Framework\TestCase; |
||
|
0 ignored issues
–
show
|
|||
| 8 | |||
| 9 | |||
| 10 | /** |
||
| 11 | * Description of DiTest |
||
| 12 | * |
||
| 13 | * @author mendel |
||
| 14 | */ |
||
| 15 | class CallTest extends TestCase |
||
| 16 | { |
||
| 17 | public function testSimpleCall() |
||
| 18 | { |
||
| 19 | $di = new \drycart\di\Container(); |
||
| 20 | $di->setConfig([ |
||
| 21 | 'drycart\di\tests\dummy\DummyInterface' => ['#class'=>'drycart\di\tests\dummy\DummyComplex'] |
||
| 22 | ]); |
||
| 23 | $obj = $di->get('drycart\di\tests\dummy\DummyInterface'); |
||
| 24 | $dummy = $di->call([$obj, 'method'], ['i'=>null]); |
||
| 25 | $this->assertTrue(is_a($dummy, 'drycart\di\tests\dummy\Dummy')); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function testFunctionCall() |
||
| 29 | { |
||
| 30 | $function = function(int $i) : int |
||
| 31 | { |
||
| 32 | return $i; |
||
| 33 | }; |
||
| 34 | // |
||
| 35 | $di = new \drycart\di\Container(); |
||
| 36 | $i = $di->call($function, ['i'=>999]); |
||
| 37 | // |
||
| 38 | $this->assertEquals($i, 999); |
||
| 39 | } |
||
| 40 | } |
||
| 41 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths