Skip to content

Commit ea2787d

Browse files
authored
Merge pull request #128 from imbus/bugfix-finally-fixed-eol_date_tests
finally fixed the asset_eol_date test bug
2 parents 5d64cdb + 2b7c715 commit ea2787d

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

tests/Feature/AssetQuery/Api/DateQueryTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,25 +104,27 @@ public function testEolDateQueryEnd()
104104
$assetA = Asset::factory()->create([
105105
'model_id' => $modelA->id,
106106
'purchase_date' => $purchase,
107-
'asset_eol_date' => $eolA,
108107
'asset_tag' => 'API-EOLEND-A',
109108
'created_by' => $owner->id,
110109
]);
111110
$assetB = Asset::factory()->create([
112111
'model_id' => $modelB->id,
113112
'purchase_date' => $purchase,
114-
'asset_eol_date' => $eolB,
115113
'asset_tag' => 'API-EOLEND-B',
116114
'created_by' => $owner->id,
117115
]);
118116
$assetC = Asset::factory()->create([
119117
'model_id' => $modelC->id,
120118
'purchase_date' => $purchase,
121-
'asset_eol_date' => $eolC,
122119
'asset_tag' => 'API-EOLEND-C',
123120
'created_by' => $owner->id,
124121
]);
125122

123+
// needed because on creation there is a randomizer in the factory
124+
$assetA->update(['asset_eol_date' => $eolA]);
125+
$assetB->update(['asset_eol_date' => $eolB]);
126+
$assetC->update(['asset_eol_date' => $eolC]);
127+
126128
$filter = [
127129
[
128130
'field' => 'asset_eol_date',
@@ -133,7 +135,6 @@ public function testEolDateQueryEnd()
133135
'operator' => 'contains',
134136
'logic' => 'AND',
135137
],
136-
137138
[
138139
'field' => 'created_by',
139140
'value' => [$owner->id],

tests/Feature/AssetQuery/DateQueryTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,25 @@ public function testEolDateQueryEnd()
107107
$assetA = Asset::factory()->create([
108108
'model_id' => $modelA->id,
109109
'purchase_date' => $purchase,
110-
'asset_eol_date' => $eolA,
111110
'asset_tag' => $prefix.'-A',
112111
]);
113112
$assetB = Asset::factory()->create([
114113
'model_id' => $modelB->id,
115114
'purchase_date' => $purchase,
116-
'asset_eol_date' => $eolB,
117115
'asset_tag' => $prefix.'-B',
118116
]);
119117
$assetC = Asset::factory()->create([
120118
'model_id' => $modelC->id,
121119
'purchase_date' => $purchase,
122-
'asset_eol_date' => $eolC,
123120
'asset_tag' => $prefix.'-C',
124121
]);
125122

123+
// needed because on creation there is a randomizer in the factory
124+
125+
$assetA->update(['asset_eol_date' => $eolA]);
126+
$assetB->update(['asset_eol_date' => $eolB]);
127+
$assetC->update(['asset_eol_date' => $eolC]);
128+
126129
$filter = [
127130
[
128131
'field' => 'asset_eol_date',

0 commit comments

Comments
 (0)