| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Shamaseen\Repository\Tests\Feature; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use App\Models\Tests\Test; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Illuminate\Support\Facades\Route; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Shamaseen\Repository\Tests\TestCase; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Symfony\Component\HttpFoundation\Response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | class CrudTest extends TestCase | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |     protected string $modelName = 'Test'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |     protected string $userPath = 'Tests'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |      * @param string $dataName | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     public function __construct(?string $name = null, array $data = [], $dataName = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |         parent::__construct($name, $data, $dataName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     public function setUp(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         parent::setUp(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     public function test_index() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         Route::get('tests', [\App\Http\Controllers\Tests\TestController::class, 'index']); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         $response = $this->getJson('tests'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         $this->assertContains($response->getStatusCode(), [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |             Response::HTTP_OK, Response::HTTP_PARTIAL_CONTENT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     public function test_show() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         Route::get('tests/{id}', [\App\Http\Controllers\Tests\TestController::class, 'show']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         $response = $this->getJson('tests/1'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         $this->assertContains($response->getStatusCode(), [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             Response::HTTP_OK | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     public function test_create() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         Route::get('tests/create', [\App\Http\Controllers\Tests\TestController::class, 'create']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         $response = $this->getJson('tests/create'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         $this->assertContains($response->getStatusCode(), [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |             Response::HTTP_NO_CONTENT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     public function test_store() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         Route::post('tests', [\App\Http\Controllers\Tests\TestController::class, 'store']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         $data = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |             'name' => 'Create Test', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |             'type' => 'New' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         $response = $this->postJson('tests', $data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         $this->assertContains($response->getStatusCode(), [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |             Response::HTTP_CREATED | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         $content = json_decode($response->getContent())->data; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         $test = Test::findOrFail($content->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         $this->assertEquals($data['name'], $test->name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         $this->assertEquals($data['type'], $test->type); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         return $content->id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      * @depends test_store | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     public function test_update(int $id) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         Route::put('tests/{id}', [\App\Http\Controllers\Tests\TestController::class, 'update']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         $data = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |             'name' => 'Update Test', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |             'type' => 'Updated' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         $response = $this->putJson('tests/'.$id, $data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         $this->assertContains($response->getStatusCode(), [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             Response::HTTP_OK | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |         $test = Test::findOrFail($id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |         $this->assertEquals($data['name'], $test->name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         $this->assertEquals($data['type'], $test->type); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |      * @depends test_store | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 106 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 107 |  |  |     public function test_delete(int $id) | 
            
                                                                        
                            
            
                                    
            
            
                | 108 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 109 |  |  |         Route::delete('tests/{id}', [\App\Http\Controllers\Tests\TestController::class, 'destroy']); | 
            
                                                                        
                            
            
                                    
            
            
                | 110 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 111 |  |  |         $response = $this->deleteJson('tests/'.$id); | 
            
                                                                        
                            
            
                                    
            
            
                | 112 |  |  |         $this->assertContains($response->getStatusCode(), [ | 
            
                                                                        
                            
            
                                    
            
            
                | 113 |  |  |             Response::HTTP_OK | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |         ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 116 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 117 |  |  |  | 
            
                        
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