yiisoft /
demo
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | declare(strict_types=1); |
||||||
| 4 | |||||||
| 5 | namespace App\Tests\Functional; |
||||||
| 6 | |||||||
| 7 | use App\VersionProvider; |
||||||
| 8 | use PHPUnit\Framework\TestCase; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 9 | use Yiisoft\Yii\Testing\FunctionalTester; |
||||||
|
0 ignored issues
–
show
The type
Yiisoft\Yii\Testing\FunctionalTester was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 10 | |||||||
| 11 | final class IndexControllerTest extends TestCase |
||||||
| 12 | { |
||||||
| 13 | private ?FunctionalTester $tester; |
||||||
| 14 | |||||||
| 15 | protected function setUp(): void |
||||||
| 16 | { |
||||||
| 17 | $this->tester = new FunctionalTester(); |
||||||
| 18 | } |
||||||
| 19 | |||||||
| 20 | public function testGetIndex(): void |
||||||
| 21 | { |
||||||
| 22 | $method = 'GET'; |
||||||
| 23 | $url = '/'; |
||||||
| 24 | |||||||
| 25 | $this->tester->bootstrapApplication(dirname(__DIR__, 2)); |
||||||
|
0 ignored issues
–
show
The method
bootstrapApplication() does not exist on null.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 26 | $response = $this->tester->doRequest($method, $url); |
||||||
| 27 | |||||||
| 28 | $this->assertEquals( |
||||||
| 29 | [ |
||||||
| 30 | 'status' => 'success', |
||||||
| 31 | 'error_message' => '', |
||||||
| 32 | 'error_code' => null, |
||||||
| 33 | 'data' => ['version' => '3.0', 'author' => 'yiisoft'], |
||||||
| 34 | ], |
||||||
| 35 | $response->getContentAsJson() |
||||||
| 36 | ); |
||||||
| 37 | } |
||||||
| 38 | |||||||
| 39 | public function testGetIndexMockVersion(): void |
||||||
| 40 | { |
||||||
| 41 | $method = 'GET'; |
||||||
| 42 | $url = '/'; |
||||||
| 43 | |||||||
| 44 | $this->tester->bootstrapApplication(dirname(__DIR__, 2)); |
||||||
| 45 | |||||||
| 46 | $this->tester->mockService(VersionProvider::class, new VersionProvider('3.0.0')); |
||||||
| 47 | |||||||
| 48 | $response = $this->tester->doRequest($method, $url); |
||||||
| 49 | |||||||
| 50 | $this->assertEquals( |
||||||
| 51 | [ |
||||||
| 52 | 'status' => 'success', |
||||||
| 53 | 'error_message' => '', |
||||||
| 54 | 'error_code' => null, |
||||||
| 55 | 'data' => ['version' => '3.0.0', 'author' => 'yiisoft'], |
||||||
| 56 | ], |
||||||
| 57 | $response->getContentAsJson() |
||||||
| 58 | ); |
||||||
| 59 | } |
||||||
| 60 | } |
||||||
| 61 |
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