DNA Service Test

    0

    0

    In the code above, the tests are using the RefreshDatabase class to reload the database. The IFrameTest class is using the WithFaker class to create a fake response.

    Library: laravel

    <?php
    
    namespace Tests\Feature\Store;
    
    use Database\Seeders\PermissionSeeder;
    use Illuminate\Foundation\Testing\RefreshDatabase;
    use Illuminate\Foundation\Testing\WithFaker;
    use Illuminate\Support\Facades\URL;
    use Tests\TestCase;
    
    class IFrameTest extends TestCase
    {
    
      use RefreshDatabase;
      use WithFaker;
    
      protected function setUp(): void
      {
        parent::setUp();
        $this->seed(PermissionSeeder::class); 
      }
    
      public function test_user_can_view_dna_service_iframe_if_product_category_is_DNA()
      {
        $purchaseConfirmedRoute = URL::signedRoute('basket.checkout', ['purchaseConfirmed' => true]);
    
        $response = $this->get(route('iframe.dna', ['purchaseConfirmedRoute' => $purchaseConfirmedRoute]));
        $response->assertStatus(200);
      }
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.