From a6ba8dd68f841048811b496a4b4c39e4e11536fd Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Fri, 8 Nov 2024 11:35:18 +0000 Subject: [PATCH] Testing: Improved reliability - Added extra column/value check for page revision test for accuracy. - Changed search sort test to use more reliable values. - Change due to database seeding somtimes generating values that proceeded the test value, expected to be first, in sort results. --- tests/Commands/UpdateUrlCommandTest.php | 1 + tests/Entity/EntitySearchTest.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/Commands/UpdateUrlCommandTest.php b/tests/Commands/UpdateUrlCommandTest.php index 1353cf803..d336e05a2 100644 --- a/tests/Commands/UpdateUrlCommandTest.php +++ b/tests/Commands/UpdateUrlCommandTest.php @@ -102,6 +102,7 @@ class UpdateUrlCommandTest extends TestCase setting()->flushCache(); $this->assertDatabaseHas('page_revisions', [ + 'page_id' => $page->id, 'markdown' => '[A link 1](https://cats.example.com/donkey/cat)', 'html' => '' . "\n" ]); diff --git a/tests/Entity/EntitySearchTest.php b/tests/Entity/EntitySearchTest.php index 57b7c3f6b..cabf23bd3 100644 --- a/tests/Entity/EntitySearchTest.php +++ b/tests/Entity/EntitySearchTest.php @@ -393,11 +393,11 @@ class EntitySearchTest extends TestCase $search = $this->actingAs($this->users->viewer())->get("/search/entity/siblings?entity_id={$contextBook->id}&entity_type=book"); $this->withHtml($search)->assertElementNotContains('a:first-child', 'Zebras'); - $searchBook->name = 'AAAAAAArdvarks'; + $searchBook->name = '1AAAAAAArdvarks'; $searchBook->save(); $search = $this->actingAs($this->users->viewer())->get("/search/entity/siblings?entity_id={$contextBook->id}&entity_type=book"); - $this->withHtml($search)->assertElementContains('a:first-child', 'AAAAAAArdvarks'); + $this->withHtml($search)->assertElementContains('a:first-child', '1AAAAAAArdvarks'); } public function test_sibling_search_for_shelves_provides_results_in_alphabetical_order() @@ -411,11 +411,11 @@ class EntitySearchTest extends TestCase $search = $this->actingAs($this->users->viewer())->get("/search/entity/siblings?entity_id={$contextShelf->id}&entity_type=bookshelf"); $this->withHtml($search)->assertElementNotContains('a:first-child', 'Zebras'); - $searchShelf->name = 'AAAAAAArdvarks'; + $searchShelf->name = '1AAAAAAArdvarks'; $searchShelf->save(); $search = $this->actingAs($this->users->viewer())->get("/search/entity/siblings?entity_id={$contextShelf->id}&entity_type=bookshelf"); - $this->withHtml($search)->assertElementContains('a:first-child', 'AAAAAAArdvarks'); + $this->withHtml($search)->assertElementContains('a:first-child', '1AAAAAAArdvarks'); } public function test_search_works_on_updated_page_content()