Skip to content

Instantly share code, notes, and snippets.

@TSKGunGun
Created December 16, 2021 23:44
Show Gist options
  • Save TSKGunGun/51f422295ce2c4d1d0ebbbe6aef4585e to your computer and use it in GitHub Desktop.
Save TSKGunGun/51f422295ce2c4d1d0ebbbe6aef4585e to your computer and use it in GitHub Desktop.
class sample_Test extends TestCase
{
use RefreshDatabase;
use WithFaker;
protected function setUp(): void
{
parent::setUp();
Category::factory(5)->create();
}
public function Sample_DataProvider()
{
return [
'1' => ['param' => 0],
'2' => ['param' => 1],
'3' => ['param' => 2],
];
}
/**
* サンプルテスト
* @test
* @dataProvider Sample_DataProvider
*/
public function test_Sample(int $param): void
{
foreach(Category::all() as $i)
{
printf("ID: {$i->id}\n");
}
$this->assertTrue(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment