Skip to content

Commit f73b597

Browse files
committed
Remove dbg
1 parent e0e71cd commit f73b597

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

src/Database/Adapter/MariaDB.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,7 @@ public function find(string $collection, array $queries = [], ?int $limit = 25,
16161616
{$sqlOrder}
16171617
{$sqlLimit};
16181618
";
1619-
var_dump($sql);
1619+
16201620
$sql = $this->trigger(Database::EVENT_DOCUMENT_FIND, $sql);
16211621

16221622
try {

tests/e2e/Adapter/Scopes/DocumentTests.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,55 @@ public function testFindOrderByCursorAfter(): void
19001900
Query::cursorAfter($movies[5])
19011901
]);
19021902
$this->assertEmpty(count($documents));
1903+
1904+
/**
1905+
* Multiple order by, Test tie-break on year 2019
1906+
*/
1907+
$movies = $database->find('movies', [
1908+
Query::orderAsc('year'),
1909+
Query::orderAsc('price'),
1910+
]);
1911+
1912+
$this->assertEquals(6, count($movies));
1913+
var_dump($movies);
1914+
$this->assertEquals($movies[0]['name'], 'Captain America: The First Avenger');
1915+
$this->assertEquals($movies[0]['year'], 2011);
1916+
$this->assertEquals($movies[0]['price'], 25.94);
1917+
1918+
$this->assertEquals($movies[1]['name'], 'Frozen');
1919+
$this->assertEquals($movies[1]['year'], 2013);
1920+
$this->assertEquals($movies[1]['price'], 39.5);
1921+
1922+
$this->assertEquals($movies[2]['name'], 'Captain Marvel');
1923+
$this->assertEquals($movies[2]['year'], 2019);
1924+
$this->assertEquals($movies[2]['price'], 25.99);
1925+
1926+
$this->assertEquals($movies[3]['name'], 'Frozen II');
1927+
$this->assertEquals($movies[3]['year'], 2019);
1928+
$this->assertEquals($movies[3]['price'], 39.5);
1929+
1930+
$this->assertEquals($movies[4]['name'], 'Work in Progress');
1931+
$this->assertEquals($movies[4]['year'], 2025);
1932+
$this->assertEquals($movies[4]['price'], 0);
1933+
1934+
$this->assertEquals($movies[5]['name'], 'Work in Progress 2');
1935+
$this->assertEquals($movies[5]['year'], 2026);
1936+
$this->assertEquals($movies[5]['price'], 0);
1937+
1938+
$pos = 2;
1939+
$documents = $database->find('movies', [
1940+
Query::orderAsc('year'),
1941+
Query::orderAsc('price'),
1942+
Query::cursorAfter($movies[$pos])
1943+
]);
1944+
1945+
$this->assertEquals(3, count($documents));
1946+
1947+
foreach ($documents as $i => $document) {
1948+
$this->assertEquals($document['name'], $movies[$i + 1 + $pos]['name']);
1949+
$this->assertEquals($document['price'], $movies[$i + 1 + $pos]['price']);
1950+
$this->assertEquals($document['year'], $movies[$i + 1 + $pos]['year']);
1951+
}
19031952
}
19041953

19051954

0 commit comments

Comments
 (0)