Skip to content

Commit

Permalink
Upgrade PHPUnit to 9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Apr 12, 2020
1 parent 4c25831 commit cdd034a
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 32 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"jetbrains/phpstorm-stubs": "^2019.1",
"phpstan/phpstan": "^0.12.18",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^9.0",
"phpunit/phpunit": "^9.1",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0"
},
"suggest": {
Expand Down
101 changes: 81 additions & 20 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion tests/Functional/Schema/SQLAnywhereSchemaManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public function testCreateAndListViews() : void
self::assertCount(1, $views, 'Database has to have one view.');
self::assertInstanceOf(View::class, $views[$name]);
self::assertEquals($name, $views[$name]->getName());
self::assertRegExp('/^SELECT \* from "?DBA"?\."?view_test_table"?$/', $views[$name]->getSql());
self::assertMatchesRegularExpression(
'/^SELECT \* from "?DBA"?\."?view_test_table"?$/',
$views[$name]->getSql()
);
}

public function testDropAndCreateAdvancedIndex() : void
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Schema/SqliteSchemaManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testCreateAndDropDatabase() : void
$this->schemaManager->createDatabase($path);
self::assertFileExists($path);
$this->schemaManager->dropDatabase($path);
self::assertFileNotExists($path);
self::assertFileDoesNotExist($path);
}

/**
Expand All @@ -58,7 +58,7 @@ public function testDropsDatabaseWithActiveConnections() : void

$this->schemaManager->dropDatabase('test_drop_database');

self::assertFileNotExists('test_drop_database');
self::assertFileDoesNotExist('test_drop_database');

unset($connection);
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Tools/Console/RunSqlCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public function testSelectStatementsPrintsResult() : void
]);
self::assertSame(0, $exitCode);

self::assertRegExp('@int.*1.*@', $this->commandTester->getDisplay());
self::assertRegExp('@array.*1.*@', $this->commandTester->getDisplay());
self::assertMatchesRegularExpression('@int.*1.*@', $this->commandTester->getDisplay());
self::assertMatchesRegularExpression('@array.*1.*@', $this->commandTester->getDisplay());
}

public function testUpdateStatementsPrintsAffectedLines() : void
Expand All @@ -89,8 +89,8 @@ public function testUpdateStatementsPrintsAffectedLines() : void
'sql' => 'UPDATE foo SET bar = 42',
]);

self::assertRegExp('@int.*42.*@', $this->commandTester->getDisplay());
self::assertNotRegExp('@array.*1.*@', $this->commandTester->getDisplay());
self::assertMatchesRegularExpression('@int.*42.*@', $this->commandTester->getDisplay());
self::assertDoesNotMatchRegularExpression('@array.*1.*@', $this->commandTester->getDisplay());
}

private function expectConnectionExecuteUpdate() : void
Expand Down Expand Up @@ -123,7 +123,7 @@ public function testStatementsWithFetchResultPrintsResult() : void
'--force-fetch' => true,
]);

self::assertRegExp('@int.*1.*@', $this->commandTester->getDisplay());
self::assertRegExp('@array.*1.*@', $this->commandTester->getDisplay());
self::assertMatchesRegularExpression('@int.*1.*@', $this->commandTester->getDisplay());
self::assertMatchesRegularExpression('@array.*1.*@', $this->commandTester->getDisplay());
}
}
4 changes: 2 additions & 2 deletions tests/Types/ConversionExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testConversionFailedInvalidTypeWithScalar($scalarValue) : void
$exception = ConversionException::conversionFailedInvalidType($scalarValue, 'foo', ['bar', 'baz']);

self::assertInstanceOf(ConversionException::class, $exception);
self::assertRegExp(
self::assertMatchesRegularExpression(
'/^Could not convert PHP value \'.*\' of type \'(string|boolean|float|double|integer)\' to type \'foo\'. '
. 'Expected one of the following types: bar, baz$/',
$exception->getMessage()
Expand All @@ -47,7 +47,7 @@ public function testConversionFailedInvalidTypeWithNonScalar($nonScalar) : void
$exception = ConversionException::conversionFailedInvalidType($nonScalar, 'foo', ['bar', 'baz']);

self::assertInstanceOf(ConversionException::class, $exception);
self::assertRegExp(
self::assertMatchesRegularExpression(
'/^Could not convert PHP value of type \'(.*)\' to type \'foo\'. '
. 'Expected one of the following types: bar, baz$/',
$exception->getMessage()
Expand Down

0 comments on commit cdd034a

Please sign in to comment.