Skip to content

Commit

Permalink
[core] test for order=random_1234
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Feb 17, 2024
1 parent 0d5b938 commit 06db4a1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions core/tests/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@ public function testWeirdTags(): void
$this->assert_search_results(["exclamation%"], [$image_id_2]);
}

public function testOrder(): void
{
$this->log_in_as_user();
$i1 = $this->post_image("tests/pbx_screenshot.jpg", "question? colon:thing exclamation!");
$i2 = $this->post_image("tests/bedroom_workshop.jpg", "question. colon_thing exclamation%");
$i3 = $this->post_image("tests/favicon.png", "another");

$is1 = Search::find_images(0, null, ["order=random_4123"]);
$ids1 = array_map(fn ($image) => $image->id, $is1);
$this->assertEquals(3, count($ids1));

$is2 = Search::find_images(0, null, ["order=random_4123"]);
$ids2 = array_map(fn ($image) => $image->id, $is2);
$this->assertEquals(3, count($ids1));

$is3 = Search::find_images(0, null, ["order=random_6543"]);
$ids3 = array_map(fn ($image) => $image->id, $is3);
$this->assertEquals(3, count($ids3));

$this->assertEquals($ids1, $ids2);
$this->assertNotEquals($ids1, $ids3);
}

/**
* @return int[]
*/
Expand Down

0 comments on commit 06db4a1

Please sign in to comment.