mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-31 05:31:10 -04:00 
			
		
		
		
	build version 400
This commit is contained in:
		
							
								
								
									
										32
									
								
								tests/Unit/CountryTest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								tests/Unit/CountryTest.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | ||||
| <?php | ||||
|  | ||||
| use Crater\Models\User; | ||||
| use Crater\Models\Country; | ||||
| use Crater\Models\Address; | ||||
| use Illuminate\Support\Facades\Artisan; | ||||
| use Laravel\Sanctum\Sanctum; | ||||
|  | ||||
| beforeEach(function () { | ||||
|     Artisan::call('db:seed', ['--class' => 'DatabaseSeeder', '--force' => true]); | ||||
|     Artisan::call('db:seed', ['--class' => 'DemoSeeder', '--force' => true]); | ||||
|  | ||||
|     $user = User::where('role', 'super admin')->first(); | ||||
|     $this->withHeaders([ | ||||
|         'company' => $user->company_id, | ||||
|     ]); | ||||
|     Sanctum::actingAs( | ||||
|         $user, | ||||
|         ['*'] | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| test('country has many addresses', function () { | ||||
|     $country = Country::find(1); | ||||
|  | ||||
|     $address = Address::factory()->count(5)->create([ | ||||
|         'country_id' => $country->id | ||||
|     ]); | ||||
|  | ||||
|     $this->assertTrue($country->address()->exists()); | ||||
| }); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user