Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
cc7bc1e7
Unverified
Commit
cc7bc1e7
authored
May 07, 2020
by
Grégoire Paris
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '3.0.x'
parents
3b6e69d4
9e9e32e0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
26 deletions
+124
-26
continuous-integration.yml
.github/workflows/continuous-integration.yml
+82
-11
.travis.yml
.travis.yml
+0
-10
CreateSchemaSqlCollector.php
src/Schema/Visitor/CreateSchemaSqlCollector.php
+1
-1
ForeignKeyTest.php
tests/Functional/Schema/ForeignKeyTest.php
+37
-0
CreateSchemaSqlCollectorTest.php
tests/Schema/Visitor/CreateSchemaSqlCollectorTest.php
+4
-4
No files found.
.github/workflows/continuous-integration.yml
View file @
cc7bc1e7
...
...
@@ -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/p
salm
"
-
name
:
"
Run
squizlabs/php_codesniffer"
run
:
"
vendor/bin/p
hpcs
-q
--no-colors
--report=checkstyle
|
cs2pr
"
.travis.yml
View file @
cc7bc1e7
...
...
@@ -48,16 +48,6 @@ jobs:
-
stage
:
Smoke Testing
php
:
7.4
env
:
DB=sqlite COVERAGE=yes
-
stage
:
Smoke Testing
php
:
7.4
env
:
PHPStan
install
:
travis_retry composer install --prefer-dist
script
:
vendor/bin/phpstan analyse
-
stage
:
Smoke Testing
php
:
7.4
env
:
PHP_CodeSniffer
install
:
travis_retry composer install --prefer-dist
script
:
vendor/bin/phpcs
-
stage
:
Test
php
:
7.3
...
...
src/Schema/Visitor/CreateSchemaSqlCollector.php
View file @
cc7bc1e7
...
...
@@ -48,7 +48,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor
public
function
acceptForeignKey
(
Table
$localTable
,
ForeignKeyConstraint
$fkConstraint
)
:
void
{
if
(
!
$this
->
platform
->
supportsForeignKeyConstraints
())
{
if
(
!
$this
->
platform
->
supports
CreateDrop
ForeignKeyConstraints
())
{
return
;
}
...
...
tests/Functional/Schema/ForeignKeyTest.php
0 → 100644
View file @
cc7bc1e7
<?php
declare
(
strict_types
=
1
);
namespace
Doctrine\DBAL\Tests\Functional\Schema
;
use
Doctrine\DBAL\Schema\Schema
;
use
Doctrine\DBAL\Tests\FunctionalTestCase
;
class
ForeignKeyTest
extends
FunctionalTestCase
{
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'
)
);
}
}
tests/Schema/Visitor/CreateSchemaSqlCollectorTest.php
View file @
cc7bc1e7
...
...
@@ -31,7 +31,7 @@ class CreateSchemaSqlCollectorTest extends TestCase
'getCreateSchemaSQL'
,
'getCreateSequenceSQL'
,
'getCreateTableSQL'
,
'supportsForeignKeyConstraints'
,
'supports
CreateDrop
ForeignKeyConstraints'
,
'supportsSchemas'
,
]
)
...
...
@@ -78,11 +78,11 @@ class CreateSchemaSqlCollectorTest extends TestCase
public
function
testAcceptsForeignKey
()
:
void
{
$this
->
platformMock
->
expects
(
self
::
at
(
0
))
->
method
(
'supportsForeignKeyConstraints'
)
->
method
(
'supports
CreateDrop
ForeignKeyConstraints'
)
->
will
(
self
::
returnValue
(
false
));
$this
->
platformMock
->
expects
(
self
::
at
(
1
))
->
method
(
'supportsForeignKeyConstraints'
)
->
method
(
'supports
CreateDrop
ForeignKeyConstraints'
)
->
will
(
self
::
returnValue
(
true
));
$table
=
$this
->
createTableMock
();
...
...
@@ -108,7 +108,7 @@ class CreateSchemaSqlCollectorTest extends TestCase
public
function
testResetsQueries
()
:
void
{
foreach
([
'supportsSchemas'
,
'supportsForeignKeyConstraints'
]
as
$method
)
{
foreach
([
'supportsSchemas'
,
'supports
CreateDrop
ForeignKeyConstraints'
]
as
$method
)
{
$this
->
platformMock
->
expects
(
self
::
any
())
->
method
(
$method
)
->
will
(
self
::
returnValue
(
true
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment