Unverified Commit a8544cac authored by Grégoire Paris's avatar Grégoire Paris

Merge remote-tracking branch 'origin/2.10.x' into 2.11.x

parents 0a2e2f1e f20ba141
......@@ -5,29 +5,100 @@ on:
pull_request:
jobs:
static-analysis-phpstan:
name: "Static Analysis with PHPStan"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.4"
steps:
- name: "Checkout code"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: "cs2pr"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
- name: "Install dependencies with composer"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Run a static analysis with phpstan/phpstan"
run: "vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr"
static-analysis-psalm:
name: Static Analysis with Psalm
runs-on: ubuntu-latest
name: "Static Analysis with Psalm"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.4"
steps:
- name: "Checkout code"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
- name: "Install dependencies with composer"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Run a static analysis with vimeo/psalm"
run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=4"
coding-standards:
name: "Coding Standards"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.4"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@1.8.1"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "7.4"
php-version: "${{ matrix.php-version }}"
tools: "cs2pr"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1.0.3"
uses: "actions/cache@v1"
with:
path: "~/.composer/cache"
key: "composer-${{ hashFiles('composer.lock') }}"
restore-keys: "composer-"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
- name: "Install dependencies with composer"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: Psalm
run: "vendor/bin/psalm"
- name: "Run squizlabs/php_codesniffer"
run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"
......@@ -44,16 +44,6 @@ jobs:
- stage: Smoke Testing
php: 7.3
env: DB=sqlite COVERAGE=yes
- stage: Smoke Testing
php: 7.3
env: PHPStan
install: travis_retry composer install --prefer-dist
script: vendor/bin/phpstan analyse
- stage: Smoke Testing
php: 7.3
env: PHP_CodeSniffer
install: travis_retry composer install --prefer-dist
script: vendor/bin/phpcs
- stage: Test
php: 7.2
......
......@@ -55,7 +55,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor
*/
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{
if (! $this->platform->supportsForeignKeyConstraints()) {
if (! $this->platform->supportsCreateDropForeignKeyConstraints()) {
return;
}
......
<?php
declare(strict_types=1);
namespace Doctrine\Tests\DBAL\Functional\Schema;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Tests\DbalFunctionalTestCase;
class ForeignKeyTest extends DbalFunctionalTestCase
{
public function testCreatingATableWithAForeignKey() : void
{
$schema = new Schema();
$referencedTable = $schema->createTable('referenced_table');
$referencedTable->addColumn('id', 'integer');
$referencedTable->setPrimaryKey(['id']);
$referencingTable = $schema->createTable('referencing_table');
$referencingTable->addColumn('referenced_id', 'integer');
$referencingTable->addForeignKeyConstraint(
$referencedTable,
['referenced_id'],
['id']
);
foreach ($schema->toSql($this->connection->getDatabasePlatform()) as $sql) {
$this->connection->exec($sql);
}
self::assertCount(
1,
$this->connection->getSchemaManager()->listTableForeignKeys('referencing_table')
);
}
}
......@@ -29,7 +29,7 @@ class CreateSchemaSqlCollectorTest extends TestCase
'getCreateSchemaSQL',
'getCreateSequenceSQL',
'getCreateTableSQL',
'supportsForeignKeyConstraints',
'supportsCreateDropForeignKeyConstraints',
'supportsSchemas',
]
)
......@@ -76,11 +76,11 @@ class CreateSchemaSqlCollectorTest extends TestCase
public function testAcceptsForeignKey() : void
{
$this->platformMock->expects($this->at(0))
->method('supportsForeignKeyConstraints')
->method('supportsCreateDropForeignKeyConstraints')
->will($this->returnValue(false));
$this->platformMock->expects($this->at(1))
->method('supportsForeignKeyConstraints')
->method('supportsCreateDropForeignKeyConstraints')
->will($this->returnValue(true));
$table = $this->createTableMock();
......@@ -106,7 +106,7 @@ class CreateSchemaSqlCollectorTest extends TestCase
public function testResetsQueries() : void
{
foreach (['supportsSchemas', 'supportsForeignKeyConstraints'] as $method) {
foreach (['supportsSchemas', 'supportsCreateDropForeignKeyConstraints'] as $method) {
$this->platformMock->expects($this->any())
->method($method)
->will($this->returnValue(true));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment