Skip to content

Commit

Permalink
Merge 3795cdb into 74f1f10
Browse files Browse the repository at this point in the history
  • Loading branch information
mpyw committed Nov 13, 2021
2 parents 74f1f10 + 3795cdb commit a4c886a
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 118 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ jobs:

strategy:
matrix:
php: [5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0]
composer_flags:
- --prefer-stable --prefer-lowest
- --prefer-stable
php: [5.6, '7.0', 7.1, 7.2, 7.3, 7.4, '8.0', 8.1]
flags: [--prefer-lowest, '']

steps:
- uses: actions/checkout@v2
Expand All @@ -22,8 +20,8 @@ jobs:
php-version: ${{ matrix.php }}
coverage: xdebug

- run: composer require phpunit/phpunit --dev --no-update ${{ matrix.composer_flags }}
- run: composer update ${{ matrix.composer_flags }}
- run: composer require phpunit/phpunit --dev --no-update
- run: composer update ${{ matrix.flags }}
- run: mkdir -p build/logs
- run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
composer.lock
/vendor/
/build/logs/
.php_cs.cache
.phpunit.result.cache
34 changes: 0 additions & 34 deletions .php_cs

This file was deleted.

9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@
"autoload-dev": {
"psr-4": {
"Lampager\\Idiorm\\Tests\\": "tests/"
}
},
"files": ["tests/polyfill.php"]
},
"require": {
"php": ">=5.6",
"ext-json": "*",
"lampager/lampager": "^0.4"
},
"require-dev": {
"phpunit/phpunit": "^6.4",
"phpunit/phpunit": "*",
"nilportugues/sql-query-formatter": "^1.2.2",
"j4mie/idiorm": "^1.5",
"j4mie/paris": "^1.5"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
37 changes: 33 additions & 4 deletions tests/PaginationResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testCollectionCall()
->order_by_asc('updated_at')
->order_by_asc('id')
->seekable()
->paginate(['id' => '3', 'updated_at' => '2017-01-01 10:00:00']);
->paginate(['id' => 3, 'updated_at' => '2017-01-01 10:00:00']);

$this->assertResultSame(
3,
Expand All @@ -46,10 +46,10 @@ public function testJsonEncodeWithOption()
->order_by_asc('updated_at')
->order_by_asc('id')
->seekable()
->paginate(['id' => '3', 'updated_at' => '2017-01-01 10:00:00'])
->paginate(['id' => 3, 'updated_at' => '2017-01-01 10:00:00'])
->to_json(JSON_PRETTY_PRINT);

$expected = <<<'EOD'
$string = <<<'EOD'
{
"records": [
{
Expand Down Expand Up @@ -77,6 +77,35 @@ public function testJsonEncodeWithOption()
}
}
EOD;
$number = <<<'EOD'
{
"records": [
{
"id": 3,
"updated_at": "2017-01-01 10:00:00"
},
{
"id": 5,
"updated_at": "2017-01-01 10:00:00"
},
{
"id": 2,
"updated_at": "2017-01-01 11:00:00"
}
],
"has_previous": true,
"previous_cursor": {
"updated_at": "2017-01-01 10:00:00",
"id": 1
},
"has_next": true,
"next_cursor": {
"updated_at": "2017-01-01 11:00:00",
"id": 4
}
}
EOD;
$expected = version_compare(PHP_VERSION, '8.1', '>=') ? $number : $string;
$this->assertSame($expected, $actual);
}

Expand All @@ -93,7 +122,7 @@ public function testUndefinedMethod()
->order_by_asc('updated_at')
->order_by_asc('id')
->seekable()
->paginate(['id' => '3', 'updated_at' => '2017-01-01 10:00:00'])
->paginate(['id' => 3, 'updated_at' => '2017-01-01 10:00:00'])
->invalid();
}
}
10 changes: 5 additions & 5 deletions tests/ParisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public function testAscendingForwardInclusive()
$this->assertResultSame(
[
'records' => [
['id' => '3', 'updated_at' => '2017-01-01 10:00:00'],
['id' => '5', 'updated_at' => '2017-01-01 10:00:00'],
['id' => '2', 'updated_at' => '2017-01-01 11:00:00'],
['id' => $this->number(3), 'updated_at' => '2017-01-01 10:00:00'],
['id' => $this->number(5), 'updated_at' => '2017-01-01 10:00:00'],
['id' => $this->number(2), 'updated_at' => '2017-01-01 11:00:00'],
],
'has_previous' => true,
'previous_cursor' => ['updated_at' => '2017-01-01 10:00:00', 'id' => '1'],
'previous_cursor' => ['updated_at' => '2017-01-01 10:00:00', 'id' => $this->number(1)],
'has_next' => true,
'next_cursor' => ['updated_at' => '2017-01-01 11:00:00', 'id' => '4'],
'next_cursor' => ['updated_at' => '2017-01-01 11:00:00', 'id' => $this->number(4)],
],
lampager(Model::factory(Post::class))
->forward()->limit(3)
Expand Down
Loading

0 comments on commit a4c886a

Please sign in to comment.