Skip to content

Commit 3b10344

Browse files
committed
CI - GH Actions: Increase PHPStan version, fix a load of errors.
1 parent 0c96d3a commit 3b10344

File tree

4 files changed

+12
-28
lines changed

4 files changed

+12
-28
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
strategy:
4848
matrix:
4949
php-version:
50-
- "7.2"
50+
- "7.4"
5151

5252
services:
5353
mysql:
@@ -90,7 +90,7 @@ jobs:
9090
strategy:
9191
matrix:
9292
php-version:
93-
- "7.2"
93+
- "7.4"
9494

9595
services:
9696
mysql:
@@ -137,8 +137,7 @@ jobs:
137137
strategy:
138138
matrix:
139139
php-version:
140-
- "7.3"
141-
- "7.4"
140+
- "8.0"
142141

143142
services:
144143
mysql:

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=7.2.0",
16+
"php": ">=7.4.0 || ^8.0",
1717
"mouf/utils.common.conditioninterface": "~2.0",
1818
"mouf/utils.value.value-interface": "~1.0",
1919
"mouf/utils.common.paginable-interface": "~1.0",
2020
"mouf/utils.common.sortable-interface": "~1.0",
2121
"mouf/schema-analyzer": "~1.0",
2222
"twig/twig": "^2.11 || ^3",
23-
"greenlion/php-sql-parser": "^4.1.2",
23+
"greenlion/php-sql-parser": "^4.3",
2424
"doctrine/cache": "^1.5"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "^7.5.10",
27+
"phpunit/phpunit": "^9.5",
2828
"satooshi/php-coveralls": "~1.0",
2929
"doctrine/dbal": "~2.5",
3030
"phpstan/phpstan": "^0.12.82"

tests/Mouf/Database/MagicQuery/Twig/SqlTwigEnvironmentFactoryTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,21 @@
44

55
use Mouf\Database\MagicQuery\Twig\SqlTwigEnvironmentFactory;
66
use PHPUnit\Framework\TestCase;
7+
use Twig\Error\RuntimeError;
78

89
class SqlTwigEnvironmentFactoryTest extends TestCase
910
{
10-
/**
11-
*
12-
*/
1311
public function testIf()
1412
{
1513
$twig = SqlTwigEnvironmentFactory::getTwigEnvironment();
1614
$sql = $twig->render('SELECT * FROM toto {% if id %}WHERE id = :id{% endif %}', ['id' => 12]);
1715
$this->assertEquals('SELECT * FROM toto WHERE id = :id', $sql);
1816
}
1917

20-
/**
21-
* @expectedException \Twig\Error\RuntimeError
22-
*/
2318
public function testException()
2419
{
2520
$twig = SqlTwigEnvironmentFactory::getTwigEnvironment();
21+
$this->expectException(RuntimeError::class);
2622
$twig->render('SELECT * FROM toto WHERE id = {{ id }}', ['id' => 'hello']);
2723
}
2824
}

tests/Mouf/Database/MagicQueryTest.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -210,23 +210,19 @@ public function testStandardSelect()
210210
$this->assertEquals($sql, self::simplifySql($magicQuery->build($sql)));
211211
}
212212

213-
/**
214-
* @expectedException \Mouf\Database\MagicQueryException
215-
*/
216213
public function testInNullException() {
217214
$magicQuery = new MagicQuery();
218215

219216
$sql = 'SELECT * FROM users WHERE status IN :statuses!';
217+
$this->expectException(MagicQueryException::class);
220218
$magicQuery->build($sql, ['statuses' => NULL]);
221219
}
222220

223-
/**
224-
* @expectedException \Mouf\Database\MagicQueryException
225-
*/
226221
public function testInvalidSql() {
227222
$magicQuery = new MagicQuery();
228223

229224
$sql = 'SELECT * FROM users WHERE date_end => :startDate';
225+
$this->expectException(MagicQueryException::class);
230226
$this->assertEquals('SELECT * FROM users WHERE date_end => \'2014-06-06\'', self::simplifySql($magicQuery->build($sql, ['startDate' => '2014-06-06'])));
231227
}
232228

@@ -252,14 +248,12 @@ public function testWithCache()
252248
$this->assertEquals($sql, self::simplifySql($magicQuery->build($sql)));
253249
}
254250

255-
/**
256-
* @expectedException \Mouf\Database\MagicQueryParserException
257-
*/
258251
public function testParseError()
259252
{
260253
$magicQuery = new MagicQuery();
261254

262255
$sql = '';
256+
$this->expectException(MagicQueryParserException::class);
263257
$magicQuery->build($sql);
264258
}
265259

@@ -392,20 +386,15 @@ public function testMatchAgainst()
392386
$this->assertEquals($expectedSql, self::simplifySql($magicQuery->build($sql, $params)));
393387
}
394388

395-
/**
396-
* @expectedException \Mouf\Database\MagicQueryMissingConnectionException
397-
*/
398389
public function testMisconfiguration()
399390
{
400391
$magicQuery = new MagicQuery();
401392

402393
$sql = "SELECT role.* FROM magicjoin(role) WHERE right.label = 'my_right'";
394+
$this->expectException(MagicQueryMissingConnectionException::class);
403395
$magicQuery->build($sql);
404396
}
405397

406-
/**
407-
*
408-
*/
409398
public function testTwig()
410399
{
411400
$magicQuery = new MagicQuery();

0 commit comments

Comments
 (0)