| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Cakasim\Payone\Sdk\Tests\Log\SilentLogger; |
||
| 6 | |||
| 7 | use Cakasim\Payone\Sdk\Log\SilentLogger\SilentLogger; |
||
| 8 | use PHPUnit\Framework\TestCase; |
||
|
0 ignored issues
–
show
|
|||
| 9 | use Psr\Log\LoggerInterface; |
||
| 10 | use ReflectionClass; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @author Fabian Böttcher <[email protected]> |
||
| 14 | * @since 0.1.0 |
||
| 15 | */ |
||
| 16 | class SilentLoggerTest extends TestCase |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @testdox The logger is silent |
||
| 20 | */ |
||
| 21 | public function testSilentLogger(): void |
||
| 22 | { |
||
| 23 | $logger = new SilentLogger(); |
||
| 24 | $this->assertInstanceOf(LoggerInterface::class, $logger); |
||
| 25 | |||
| 26 | // Inspect SilentLogger to be actually silent. |
||
| 27 | // Check for exactly 3 lines of code. |
||
| 28 | $class = new ReflectionClass($logger); |
||
| 29 | $method = $class->getMethod('log'); |
||
| 30 | $this->assertEquals(3, $method->getEndLine() - $method->getStartLine()); |
||
| 31 | |||
| 32 | // Check if the lines of code are silent. |
||
| 33 | $source = file($class->getFileName()); |
||
| 34 | $this->assertRegExp('~^\s*{\s*$~', $source[$method->getStartLine()]); |
||
| 35 | $this->assertRegExp('~^\s*//~', $source[$method->getStartLine() + 1]); |
||
| 36 | $this->assertRegExp('~^\s*}\s*$~', $source[$method->getStartLine() + 2]); |
||
| 37 | } |
||
| 38 | } |
||
| 39 |
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