Skip to content

Commit 7106376

Browse files
committed
Update tests to support Laravel 6
1 parent d75349a commit 7106376

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tests/Engines/ArrayEngineTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function it_can_update_soft_deletable_records_in_the_index()
182182
'scoutKey' => 234,
183183
];
184184

185-
$this->assertEquals(['foo' => 'bar', 'objectID' => '123', 'scoutKey' => 123, 'deleted_at' => '2019-01-01T12:00:00.000000Z', '__soft_deleted' => 1], $engine->search($builder1)['hits'][0]);
185+
$this->assertEquals(['foo' => 'bar', 'objectID' => '123', 'scoutKey' => 123, 'deleted_at' => '2019-01-01 12:00:00', '__soft_deleted' => 1], $engine->search($builder1)['hits'][0]);
186186
$this->assertEquals(['foo' => 'bar', 'objectID' => '234', 'scoutKey' => 234, '__soft_deleted' => 0], $engine->search($builder2)['hits'][0]);
187187
}
188188

@@ -207,7 +207,7 @@ public function it_will_not_push_soft_delete_metadata_when_updating_if_its_not_e
207207
'scoutKey' => 234,
208208
];
209209

210-
$this->assertEquals(['foo' => 'bar', 'objectID' => '123', 'scoutKey' => 123, 'deleted_at' => '2019-01-01T12:00:00.000000Z'], $engine->search($builder1)['hits'][0]);
210+
$this->assertEquals(['foo' => 'bar', 'objectID' => '123', 'scoutKey' => 123, 'deleted_at' => '2019-01-01 12:00:00'], $engine->search($builder1)['hits'][0]);
211211
$this->assertEquals(['foo' => 'bar', 'objectID' => '234', 'scoutKey' => 234], $engine->search($builder2)['hits'][0]);
212212
}
213213

tests/Fixtures/SoftDeletableSearchableModel.php

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Sti3bas\ScoutArray\Tests\Fixtures;
44

5+
use DateTimeInterface;
56
use Illuminate\Database\Eloquent\Model;
67
use Illuminate\Database\Eloquent\SoftDeletes;
78
use Laravel\Scout\Searchable;
@@ -21,4 +22,15 @@ public function getScoutKey()
2122
{
2223
return $this->scoutKey;
2324
}
25+
26+
/**
27+
* Prepare a date for array / JSON serialization.
28+
*
29+
* @param \DateTimeInterface $date
30+
* @return string
31+
*/
32+
protected function serializeDate(DateTimeInterface $date)
33+
{
34+
return $date->format('Y-m-d H:i:s');
35+
}
2436
}

0 commit comments

Comments
 (0)