diff --git a/.env.travis b/.env.travis index b15c8b3a..a1546209 100644 --- a/.env.travis +++ b/.env.travis @@ -9,3 +9,5 @@ DB_CONNECTION=travis CACHE_DRIVER=array SESSION_DRIVER=array QUEUE_DRIVER=sync + +SCOUT_DRIVER='null' diff --git a/phpunit.xml b/phpunit.xml index 4649e2aa..3e884d17 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -26,6 +26,5 @@ - diff --git a/tests/MicropubClientTest.php b/tests/MicropubClientTest.php index c58f5da4..6efb3455 100644 --- a/tests/MicropubClientTest.php +++ b/tests/MicropubClientTest.php @@ -63,9 +63,21 @@ class MicropubClientTest extends TestCase //my client has made a request to my endpoint, which then adds //to the db, so database transaction don’t work //so lets manually delete the new entry + //first, if we are using algolia, we need to delete it + if (env('SCOUT_DRIVER') == 'algolia') { + //we need to allow the index to update in order to query it + sleep(2); + $client = new \AlgoliaSearch\Client(env('ALGOLIA_APP_ID'), env('ALGOLIA_SECRET')); + $index = $client->initIndex('notes'); + //here we query for the new note and tell algolia too delete it + $res = $index->deleteByQuery('Fake note from'); + if ($res == 0) { + //somehow the new not didn’t get deleted + $this->fail('Didn’t delete the note from the index'); + } + } $newNote = \App\Note::where('note', $note)->first(); - $newNote->unsearchable(); - $newNote->delete(); + $newNote->forceDelete(); }