fixed tests

This commit is contained in:
Denis Duliçi 2020-12-08 17:00:57 +03:00
parent 7c674b691b
commit 4c9234cba6
2 changed files with 11 additions and 4 deletions

View File

@ -28,7 +28,7 @@ class Item extends Factory
'purchase_price' => $this->faker->randomFloat(2, 10, 20), 'purchase_price' => $this->faker->randomFloat(2, 10, 20),
'sale_price' => $this->faker->randomFloat(2, 10, 20), 'sale_price' => $this->faker->randomFloat(2, 10, 20),
'category_id' => $this->company->categories()->item()->get()->random(1)->pluck('id')->first(), 'category_id' => $this->company->categories()->item()->get()->random(1)->pluck('id')->first(),
'tax_id' => null, 'tax_ids' => [],
'enabled' => $this->faker->boolean ? 1 : 0, 'enabled' => $this->faker->boolean ? 1 : 0,
]; ];
} }

View File

@ -34,7 +34,7 @@ class ItemsTest extends FeatureTestCase
$this->assertFlashLevel('success'); $this->assertFlashLevel('success');
$this->assertDatabaseHas('items', $request); $this->assertDatabaseHas('items', $this->getAssertRequest($request));
} }
public function testItShouldSeeItemUpdatePage() public function testItShouldSeeItemUpdatePage()
@ -64,7 +64,7 @@ class ItemsTest extends FeatureTestCase
$this->assertFlashLevel('success'); $this->assertFlashLevel('success');
$this->assertDatabaseHas('items', $request); $this->assertDatabaseHas('items', $this->getAssertRequest($request));
} }
public function testItShouldDeleteItem() public function testItShouldDeleteItem()
@ -79,11 +79,18 @@ class ItemsTest extends FeatureTestCase
$this->assertFlashLevel('success'); $this->assertFlashLevel('success');
$this->assertSoftDeleted('items', $request); $this->assertSoftDeleted('items', $this->getAssertRequest($request));
} }
public function getRequest() public function getRequest()
{ {
return Item::factory()->enabled()->raw(); return Item::factory()->enabled()->raw();
} }
public function getAssertRequest($request)
{
unset($request['tax_ids']);
return $request;
}
} }