Last active
          September 1, 2024 16:02 
        
      - 
      
- 
        Save smeghead/ed430fe84900c1c71148f5c1c17e3047 to your computer and use it in GitHub Desktop. 
    ShowTest DataFactory
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <?php | |
| namespace Tests\Feature\View\Function; | |
| use App\Models\PhelFunction; | |
| use App\Models\PhelNamespace; | |
| use App\Models\UsageExample; | |
| use App\Models\User; | |
| use Tests\TestCase; | |
| class ShowTest extends TestCase | |
| { | |
| public function test_exact_items_count(): void | |
| { | |
| $count = fake()->randomNumber(2); | |
| $function = PhelFunction::factory() | |
| ->for(PhelNamespace::factory()) | |
| ->create(); | |
| $examples = UsageExample::factory() | |
| ->count($count) | |
| ->for(User::factory()) | |
| ->for($function) | |
| ->create(); | |
| $contents = $this->view('function.show', [ | |
| 'function' => $function | |
| ]); | |
| $contents->assertSee($function->phelNamespace->namespace . '/' . $function->name); | |
| $contents->assertSee($count . ' examples.', false); | |
| foreach ($examples as $example) { | |
| $contents->assertSee('id="' . $example->id . '"', false); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment