Skip to content

Commit a6d80b7

Browse files
authored
Revert "[9.x] Improve test forPageBeforeId, forPageAfterId in Query BuilderClass (#44308)" (#44316)
This reverts commit ed4d751.
1 parent 826f0ed commit a6d80b7

File tree

1 file changed

+0
-86
lines changed

1 file changed

+0
-86
lines changed

tests/Database/DatabaseQueryBuilderTest.php

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,92 +1863,6 @@ public function testForPage()
18631863
$this->assertSame('select * from "users" limit 0 offset 0', $builder->toSql());
18641864
}
18651865

1866-
public function testForPageBeforeId()
1867-
{
1868-
$builder = $this->getBuilder();
1869-
$builder->select('*')->from('users')->forPageBeforeId();
1870-
$this->assertSame('select * from "users" where "id" < ? order by "id" desc limit 15', $builder->toSql());
1871-
$this->assertEquals([0 => 0], $builder->getBindings());
1872-
1873-
$builder = $this->getBuilder();
1874-
$builder->select('*')->from('users')->forPageBeforeId(10, 0);
1875-
$this->assertSame('select * from "users" where "id" < ? order by "id" desc limit 10', $builder->toSql());
1876-
$this->assertEquals([0 => 0], $builder->getBindings());
1877-
1878-
$builder = $this->getBuilder();
1879-
$builder->select('*')->from('users')->forPageBeforeId(-2, 0);
1880-
$this->assertSame('select * from "users" where "id" < ? order by "id" desc', $builder->toSql());
1881-
$this->assertEquals([0 => 0], $builder->getBindings());
1882-
1883-
$builder = $this->getBuilder();
1884-
$builder->select('*')->from('users')->forPageBeforeId(10, 20);
1885-
$this->assertSame('select * from "users" where "id" < ? order by "id" desc limit 10', $builder->toSql());
1886-
$this->assertEquals([0 => 20], $builder->getBindings());
1887-
1888-
$builder = $this->getBuilder();
1889-
$builder->select('*')->from('users')->forPageBeforeId(0, 20);
1890-
$this->assertSame('select * from "users" where "id" < ? order by "id" desc limit 0', $builder->toSql());
1891-
$this->assertEquals([0 => 20], $builder->getBindings());
1892-
1893-
$builder = $this->getBuilder();
1894-
$builder->select('*')->from('users')->forPageBeforeId(-10, -20);
1895-
$this->assertSame('select * from "users" where "id" < ? order by "id" desc', $builder->toSql());
1896-
$this->assertEquals([0 => -20], $builder->getBindings());
1897-
1898-
$builder = $this->getBuilder();
1899-
$builder->select('*')->from('users')->forPageBeforeId(10, 20, 'name');
1900-
$this->assertSame('select * from "users" where "name" < ? order by "name" desc limit 10', $builder->toSql());
1901-
$this->assertEquals([0 => 20], $builder->getBindings());
1902-
1903-
$builder = $this->getBuilder();
1904-
$builder->select('*')->from('users')->orderBy('id', 'asc')->forPageBeforeId(10, 0, 'id');
1905-
$this->assertSame('select * from "users" where "id" < ? order by "id" desc limit 10', $builder->toSql());
1906-
$this->assertEquals([0 => 0], $builder->getBindings());
1907-
}
1908-
1909-
public function testForPageAfterId()
1910-
{
1911-
$builder = $this->getBuilder();
1912-
$builder->select('*')->from('users')->forPageAfterId();
1913-
$this->assertSame('select * from "users" where "id" > ? order by "id" asc limit 15', $builder->toSql());
1914-
$this->assertEquals([0 => 0], $builder->getBindings());
1915-
1916-
$builder = $this->getBuilder();
1917-
$builder->select('*')->from('users')->forPageAfterId(10, 0);
1918-
$this->assertSame('select * from "users" where "id" > ? order by "id" asc limit 10', $builder->toSql());
1919-
$this->assertEquals([0 => 0], $builder->getBindings());
1920-
1921-
$builder = $this->getBuilder();
1922-
$builder->select('*')->from('users')->forPageAfterId(-2, 0);
1923-
$this->assertSame('select * from "users" where "id" > ? order by "id" asc', $builder->toSql());
1924-
$this->assertEquals([0 => 0], $builder->getBindings());
1925-
1926-
$builder = $this->getBuilder();
1927-
$builder->select('*')->from('users')->forPageAfterId(10, 20);
1928-
$this->assertSame('select * from "users" where "id" > ? order by "id" asc limit 10', $builder->toSql());
1929-
$this->assertEquals([0 => 20], $builder->getBindings());
1930-
1931-
$builder = $this->getBuilder();
1932-
$builder->select('*')->from('users')->forPageAfterId(0, 20);
1933-
$this->assertSame('select * from "users" where "id" > ? order by "id" asc limit 0', $builder->toSql());
1934-
$this->assertEquals([0 => 20], $builder->getBindings());
1935-
1936-
$builder = $this->getBuilder();
1937-
$builder->select('*')->from('users')->forPageAfterId(-10, -20);
1938-
$this->assertSame('select * from "users" where "id" > ? order by "id" asc', $builder->toSql());
1939-
$this->assertEquals([0 => -20], $builder->getBindings());
1940-
1941-
$builder = $this->getBuilder();
1942-
$builder->select('*')->from('users')->forPageAfterId(10, 20, 'name');
1943-
$this->assertSame('select * from "users" where "name" > ? order by "name" asc limit 10', $builder->toSql());
1944-
$this->assertEquals([0 => 20], $builder->getBindings());
1945-
1946-
$builder = $this->getBuilder();
1947-
$builder->select('*')->from('users')->orderBy('id', 'asc')->forPageAfterId(10, 0, 'id');
1948-
$this->assertSame('select * from "users" where "id" > ? order by "id" asc limit 10', $builder->toSql());
1949-
$this->assertEquals([0 => 0], $builder->getBindings());
1950-
}
1951-
19521866
public function testGetCountForPaginationWithBindings()
19531867
{
19541868
$builder = $this->getBuilder();

0 commit comments

Comments
 (0)