Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add phpunit v11 support #1188

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"phpstan/phpstan": "^1.6",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-strict-rules": "^1.3",
"phpunit/phpunit": "^9.5.25 || ^10.0"
"phpunit/phpunit": "^9.5.25 || ^10.0 || ^11.0"
},
"conflict": {
"jdorn/sql-formatter": "<1.2.16"
Expand Down
2 changes: 2 additions & 0 deletions tests/FieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Atk4\Data\Model;
use Atk4\Data\Schema\TestCase;
use Atk4\Data\ValidationException;
use PHPUnit\Framework\Attributes\DataProvider;

class FieldTest extends TestCase
{
Expand Down Expand Up @@ -141,6 +142,7 @@ public function testRequiredStringZeroException(): void
/**
* @dataProvider provideRequiredNumericZeroExceptionCases
*/
#[DataProvider('provideRequiredNumericZeroExceptionCases')]
public function testRequiredNumericZeroException(string $type): void
{
$m = new Model();
Expand Down
2 changes: 2 additions & 0 deletions tests/Persistence/GenericPlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Atk4\Core\Phpunit\TestCase;
use Atk4\Data\Persistence\GenericPlatform;
use Doctrine\DBAL\Exception as DbalException;
use PHPUnit\Framework\Attributes\DataProvider;

class GenericPlatformTest extends TestCase
{
Expand All @@ -27,6 +28,7 @@ public function testInitializeDoctrineTypeMappings(): void
*
* @param list<mixed> $args
*/
#[DataProvider('provideNotSupportedExceptionCases')]
public function testNotSupportedException(string $methodName, array $args): void
{
$genericPlatform = new GenericPlatform();
Expand Down
2 changes: 2 additions & 0 deletions tests/Persistence/Sql/ExpressionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Atk4\Data\Persistence\Sql\Expressionable;
use Atk4\Data\Persistence\Sql\Mysql;
use Atk4\Data\Persistence\Sql\Sqlite;
use PHPUnit\Framework\Attributes\DataProvider;

class ExpressionTest extends TestCase
{
Expand Down Expand Up @@ -145,6 +146,7 @@ public function testConstructor4(): void
*
* @dataProvider provideNoTemplatingInSqlStringCases
*/
#[DataProvider('provideNoTemplatingInSqlStringCases')]
public function testNoTemplatingInSqlString(string $expectedStr, string $exprTemplate, array $exprArguments): void
{
self::assertSame($expectedStr, $this->e($exprTemplate, $exprArguments)->render()[0]);
Expand Down
6 changes: 6 additions & 0 deletions tests/Persistence/Sql/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use Atk4\Data\Persistence\Sql\Expression;
use Atk4\Data\Persistence\Sql\Mysql;
use Atk4\Data\Persistence\Sql\Query;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;

class QueryTest extends TestCase
{
Expand Down Expand Up @@ -204,6 +206,7 @@ public function testFieldDuplicateAliasException(): void
/**
* @doesNotPerformAssertions
*/
#[DoesNotPerformAssertions]
public function testTableNoAliasExpressionException(): void
{
// $this->expectException(Exception::class); // no more
Expand Down Expand Up @@ -664,6 +667,7 @@ public function testWhereIncompatibleObject3(): void
*
* @dataProvider provideWhereUnsupportedOperatorCases
*/
#[DataProvider('provideWhereUnsupportedOperatorCases')]
public function testWhereUnsupportedOperator(string $operator, $value): void
{
$q = $this->q('[where]')->where('x', $operator, $value);
Expand Down Expand Up @@ -1162,6 +1166,7 @@ public function testSetException1(): void
*
* @doesNotPerformAssertions
*/
#[DoesNotPerformAssertions]
public function testSetException2(): void
{
$this->q()->set($this->e('foo'), 1);
Expand Down Expand Up @@ -1329,6 +1334,7 @@ public function testCaseExprShortForm(): void
*
* @doesNotPerformAssertions
*/
#[DoesNotPerformAssertions]
public function testCaseExprException1(): void
{
// $this->expectException(Exception::class);
Expand Down
2 changes: 2 additions & 0 deletions tests/Persistence/Sql/WithDb/SelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use PHPUnit\Framework\Attributes\DataProvider;

class SelectTest extends TestCase
{
Expand Down Expand Up @@ -251,6 +252,7 @@ public function testWhereExpression(): void
* @param array{string, array<mixed>} $exprLeft
* @param array{string, array<mixed>} $exprRight
*/
#[DataProvider('provideWhereNumericCompareCases')]
public function testWhereNumericCompare(array $exprLeft, string $operator, array $exprRight, bool $expectPostgresqlTypeMismatchException = false, bool $expectMssqlTypeMismatchException = false): void
{
if ($this->getDatabasePlatform() instanceof OraclePlatform) {
Expand Down
3 changes: 3 additions & 0 deletions tests/Schema/MigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use PHPUnit\Framework\Attributes\DataProvider;

class MigratorTest extends TestCase
{
Expand Down Expand Up @@ -88,6 +89,7 @@ public function testDropIfExists(): void
/**
* @dataProvider provideCharacterTypeFieldCaseSensitivityCases
*/
#[DataProvider('provideCharacterTypeFieldCaseSensitivityCases')]
public function testCharacterTypeFieldCaseSensitivity(string $type, bool $isBinary): void
{
$model = new Model($this->db, ['table' => 'user']);
Expand Down Expand Up @@ -147,6 +149,7 @@ protected function makePseudoRandomString(bool $isBinary, int $length): string
/**
* @dataProvider provideCharacterTypeFieldLongCases
*/
#[DataProvider('provideCharacterTypeFieldLongCases')]
public function testCharacterTypeFieldLong(string $type, bool $isBinary, int $length): void
{
if ($length > 1000) {
Expand Down
Loading