Unit test fix. Cleaner this way.

This commit is contained in:
Daniel Meltzer 2020-04-28 11:37:13 -04:00
parent 05187eb27f
commit 9520ccae47
No known key found for this signature in database
GPG key ID: 91C5C7B09A5B1CA0
2 changed files with 4 additions and 4 deletions

View file

@ -87,11 +87,11 @@ class BaseTest extends \Codeception\TestCase\Test
); );
} }
protected function createValidAsset($overrides = [], $qty = 1) protected function createValidAsset($overrides = [])
{ {
$locId = $this->createValidLocation()->id; $locId = $this->createValidLocation()->id;
$this->createValidAssetModel(); $this->createValidAssetModel();
return factory(\App\Models\Asset::class, $qty)->states('laptop-mbp')->create( return factory(\App\Models\Asset::class)->states('laptop-mbp')->create(
array_merge([ array_merge([
'rtd_location_id' => $locId, 'rtd_location_id' => $locId,
'location_id' => $locId, 'location_id' => $locId,

View file

@ -38,8 +38,8 @@ class CategoryTest extends BaseTest
$this->assertCount(5, $category->models); $this->assertCount(5, $category->models);
$models->each(function($model) { $models->each(function($model) {
// factory(App\Models\Asset::class, 2)->create(['model_id' => $model->id]); $this->createValidAsset(['model_id' => $model->id]);
$this->createValidAsset(['model_id' => $model->id], 2); $this->createValidAsset(['model_id' => $model->id]);
}); });
$this->assertEquals(10, $category->itemCount()); $this->assertEquals(10, $category->itemCount());
} }