Skip to content

Commit

Permalink
Merge 70f882b into ed7212e
Browse files Browse the repository at this point in the history
  • Loading branch information
pvsaintpe committed Dec 23, 2020
2 parents ed7212e + 70f882b commit d860a65
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 103 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
fail-fast: false
matrix:
exclude_group:
- WithoutSchema
- WithoutSchema,forPHP8
experimental:
- false
operating_system:
Expand All @@ -83,37 +83,37 @@ jobs:
php_versions: '7.3'
postgres: '9.6'
experimental: false
exclude_group: WithoutSchema
exclude_group: WithoutSchema,forPHP8
- operating_system: 'ubuntu-latest'
php_versions: '7.3'
postgres: '13'
experimental: false
exclude_group: WithoutSchema
exclude_group: WithoutSchema,forPHP8
- operating_system: 'ubuntu-latest'
php_versions: '7.4'
postgres: '13'
experimental: false
exclude_group: WithoutSchema
exclude_group: WithoutSchema,forPHP8
- operating_system: 'ubuntu-latest'
php_versions: '8.0'
postgres: '10'
experimental: true
exclude_group: WithSchema
experimental: false
exclude_group: WithoutSchema,forPHP7
- operating_system: 'ubuntu-latest'
php_versions: '8.0'
postgres: '11'
experimental: true
exclude_group: WithSchema
experimental: false
exclude_group: WithoutSchema,forPHP7
- operating_system: 'ubuntu-latest'
php_versions: '8.0'
postgres: '12'
experimental: true
exclude_group: WithSchema
experimental: false
exclude_group: WithoutSchema,forPHP7
- operating_system: 'ubuntu-latest'
php_versions: '8.0'
postgres: '13'
experimental: true
exclude_group: WithSchema
experimental: false
exclude_group: WithoutSchema,forPHP7
runs-on: '${{ matrix.operating_system }}'
services:
postgres:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"require": {
"php": "^7.2|^7.3|^7.4|^8.0",
"doctrine/dbal": "2.9.*|2.12.*",
"doctrine/dbal": "2.9.*|^3.0",
"laravel/framework": "^5.8|^6.0|^7.0|^8.0"
},
"require-dev": {
Expand Down
168 changes: 84 additions & 84 deletions composer.lock

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

2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
stopOnFailure="true">
<php>
<var name="db_type" value="pdo_pgsql"/>
<var name="db_host" value="localhost" />
Expand Down
2 changes: 1 addition & 1 deletion tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ composer lint
if [ "x$EXCLUDE_GROUP" != "x" ]; then
php -d pcov.directory='.' vendor/bin/phpunit --exclude-group $EXCLUDE_GROUP --coverage-html build
else
php -d pcov.directory='.' vendor/bin/phpunit --exclude-group WithoutSchema --coverage-html build
php -d pcov.directory='.' vendor/bin/phpunit --exclude-group WithoutSchema,forPHP7,forPHP8 --coverage-html build
fi
25 changes: 21 additions & 4 deletions tests/Functional/Subscribers/ChangeColumnSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ public function getSubscriberEvents(): void

/**
* @test
* @group forPHP7
* @dataProvider provideSchemas
*/
public function changeSchema(string $column, Closure $callback, array $expectedSQL): void
public function changeSchema7(string $column, Closure $callback, array $expectedSQL): void
{
$callback($this->blueprint, $column);
$eventArgs = $this->getEventArgsForColumn($column);
Expand All @@ -81,6 +82,20 @@ public function changeSchema(string $column, Closure $callback, array $expectedS
$this->assertSame($expectedSQL, $eventArgs->getSql());
}

/**
* @test
* @group forPHP8
* @dataProvider provideSchemas
*/
public function changeSchema8(string $column, Closure $callback, array $expectedSQL): void
{
$callback($this->blueprint, $column);
$eventArgs = $this->getEventArgsForColumn($column, 'tableColumn');
$this->subscriber->onSchemaAlterTableChangeColumn($eventArgs);

$this->assertSame($expectedSQL, $eventArgs->getSql());
}

public function provideSchemas(): Generator
{
yield $this->dropCommentCase();
Expand All @@ -94,8 +109,10 @@ public function provideSchemas(): Generator
yield $this->changeLengthCase();
}

private function getEventArgsForColumn(string $columnName): SchemaAlterTableChangeColumnEventArgs
{
private function getEventArgsForColumn(
string $columnName,
string $argumentName = 'tableName'
): SchemaAlterTableChangeColumnEventArgs {
/** @var PostgresConnection $connection */
$connection = DB::connection();
$schemaManager = $connection->getDoctrineSchemaManager();
Expand All @@ -106,7 +123,7 @@ private function getEventArgsForColumn(string $columnName): SchemaAlterTableChan
$schemaManager,
'_getPortableTableColumnDefinition',
[
'tableName' => $listColumn,
$argumentName => $listColumn,
]
);
}
Expand Down

0 comments on commit d860a65

Please sign in to comment.