Skip to content

Commit 77cd94f

Browse files
authored
Merge pull request #22 from aszenz/master
deps: Upgrade to dbal v3 + fix tests/ci
2 parents 1aacb60 + 47f031a commit 77cd94f

14 files changed

+176
-136
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
jobs:
9+
test:
10+
name: "Test"
11+
runs-on: "ubuntu-latest"
12+
13+
strategy:
14+
matrix:
15+
php-version:
16+
- "7.4"
17+
- "8.0"
18+
- "8.1"
19+
- "8.2"
20+
- "8.3"
21+
dependencies:
22+
- "lowest"
23+
- "highest"
24+
25+
steps:
26+
- name: "Checkout"
27+
uses: "actions/checkout@v4"
28+
29+
- name: "Install PHP"
30+
uses: "shivammathur/setup-php@v2"
31+
with:
32+
coverage: "xdebug"
33+
php-version: "${{ matrix.php-version }}"
34+
ini-values: "zend.assertions=1"
35+
36+
- uses: "ramsey/composer-install@v2"
37+
with:
38+
dependency-versions: "${{ matrix.dependencies }}"
39+
40+
# dbal-fluid-schema-builder doesn't support v1.0 only v1.4
41+
- name: Update doctrine/inflector to v1.4 from v1.0
42+
if: "${{ 'lowest' == matrix.dependencies }}"
43+
run: |
44+
composer update doctrine/inflector:1.4 --ignore-platform-reqs
45+
46+
- name: "Run PHPUnit"
47+
run: "vendor/bin/phpunit -c phpunit.xml.dist"
48+
49+
- name: Upload coverage results to Coveralls
50+
# skip php-coversalls for lowest deps
51+
# it fails on lowest depedencies because old versions of guzzle doesn't work well with newer php versions
52+
if: "${{ 'highest' == matrix.dependencies }}"
53+
env:
54+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
run: |
56+
vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/vendor/
22
/composer.lock
33
/build/
4-
/phpunit.xml
4+
/phpunit.xml
5+
.phpunit.result.cache

.phpunit.result.cache

Lines changed: 0 additions & 1 deletion
This file was deleted.

.scrutinizer.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
build:
22
environment:
33
php:
4-
version: 7.1
4+
version: 8.1
5+
ini:
6+
xdebug.mode: coverage
57

68
checks:
79
php:

.travis.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

composer.json

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
}
1010
],
1111
"require": {
12-
"php": ">=7.1",
13-
"thecodingmachine/dbal-fluid-schema-builder": "^1.6.1",
14-
"doctrine/dbal": "^2.5"
12+
"php": "^7.4 || ^8.0",
13+
"thecodingmachine/dbal-fluid-schema-builder": "^2.0",
14+
"doctrine/dbal": "^3.0"
1515
},
1616
"require-dev": {
17-
"phpunit/phpunit": "^7.5.6",
18-
"satooshi/php-coveralls": "^1.1"
17+
"phpunit/phpunit": "^9.6.16",
18+
"php-coveralls/php-coveralls": "^2.7.0"
1919
},
2020
"autoload": {
2121
"psr-4": {
@@ -28,10 +28,5 @@
2828
}
2929
},
3030
"minimum-stability": "dev",
31-
"prefer-stable": true,
32-
"extra": {
33-
"branch-alias": {
34-
"dev-master": "1.0.x-dev"
35-
}
36-
}
31+
"prefer-stable": true
3732
}

phpunit.xml.dist

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
bootstrap="vendor/autoload.php"
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
5+
backupGlobals="false"
6+
backupStaticAttributes="false"
7+
colors="true"
8+
convertErrorsToExceptions="true"
9+
convertNoticesToExceptions="true"
10+
convertWarningsToExceptions="true"
11+
processIsolation="false"
12+
stopOnFailure="false"
13+
bootstrap="vendor/autoload.php"
1214
>
13-
<testsuites>
14-
<testsuite name="Test Suite">
15-
<directory>./tests/</directory>
16-
</testsuite>
17-
</testsuites>
15+
<testsuites>
16+
<testsuite name="Test Suite">
17+
<directory>./tests/</directory>
18+
</testsuite>
19+
</testsuites>
1820

19-
<filter>
20-
<whitelist processUncoveredFilesFromWhitelist="true">
21-
<directory suffix=".php">src/</directory>
22-
</whitelist>
23-
</filter>
24-
<logging>
25-
<log type="coverage-html" target="build/coverage"/>
26-
<log type="coverage-clover" target="build/logs/clover.xml"/>
27-
</logging>
21+
<coverage processUncoveredFiles="true">
22+
<include>
23+
<directory suffix=".php">src/</directory>
24+
</include>
25+
<report>
26+
<clover outputFile="build/logs/clover.xml"/>
27+
<html outputDirectory="build/coverage"/>
28+
</report>
29+
</coverage>
30+
<logging/>
2831
</phpunit>

src/TdbmFluidColumn.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ public function dateInterval(): TdbmFluidColumnOptions
154154
return $this->getOptions($options);
155155
}
156156

157+
/**
158+
* @deprecated Use json() instead
159+
*/
157160
public function array(): TdbmFluidColumnOptions
158161
{
159162
$options = $this->fluidColumn->array();
@@ -172,12 +175,18 @@ public function json(): TdbmFluidColumnOptions
172175
return $this->getOptions($options);
173176
}
174177

178+
/**
179+
* @deprecated Use json() instead
180+
*/
175181
public function jsonArray(): TdbmFluidColumnOptions
176182
{
177183
$options = $this->fluidColumn->jsonArray();
178184
return $this->getOptions($options);
179185
}
180186

187+
/**
188+
* @deprecated Use json() instead
189+
*/
181190
public function object(): TdbmFluidColumnOptions
182191
{
183192
$options = $this->fluidColumn->object();

src/TdbmFluidColumnGraphqlOptions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use function addslashes;
88
use Doctrine\DBAL\Types\Type;
9+
use Doctrine\DBAL\Types\Types;
10+
911
use function var_export;
1012

1113
class TdbmFluidColumnGraphqlOptions
@@ -62,7 +64,7 @@ private function generateFieldAnnotation(): void
6264
$outputType = null;
6365
if ($this->outputType !== null) {
6466
$outputType = $this->outputType;
65-
} elseif ($this->fluidColumn->getDbalColumn()->getType() === Type::getType(Type::GUID)) {
67+
} elseif ($this->fluidColumn->getDbalColumn()->getType() === Type::getType(Types::GUID)) {
6668
// are we part of a foreign key or not?
6769
$fks = $this->tdbmFluidColumnOptions->then()->getDbalTable()->getForeignKeys();
6870
$isPartOfFk = false;

tests/TdbmFluidColumnGraphqlOptionsTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace TheCodingMachine\FluidSchema;
44

55
use Doctrine\DBAL\Schema\Schema;
6-
use Doctrine\DBAL\Types\Type;
76
use PHPUnit\Framework\TestCase;
87

98
class TdbmFluidColumnGraphqlOptionsTest extends TestCase
@@ -43,19 +42,19 @@ public function testGraphql()
4342
$column2 = $graphqlOptions->column('foo');
4443
$this->assertSame($column2, $column);
4544

46-
$this->assertContains('@TheCodingMachine\GraphQLite\Annotations\Type', $schema->getTable('posts')->getOptions()['comment']);
45+
$this->assertStringContainsString('@TheCodingMachine\GraphQLite\Annotations\Type', $schema->getTable('posts')->getOptions()['comment']);
4746

4847
$idColumn = $posts->id()->graphqlField();
49-
$this->assertContains('outputType = "ID"', $schema->getTable('posts')->getColumn('id')->getComment());
48+
$this->assertStringContainsString('outputType = "ID"', $schema->getTable('posts')->getColumn('id')->getComment());
5049

5150
$users = $fluid->table('users');
5251
$uuidColumn = $users->uuid()->graphqlField();
53-
$this->assertContains('outputType = "ID"', $schema->getTable('users')->getColumn('uuid')->getComment());
52+
$this->assertStringContainsString('outputType = "ID"', $schema->getTable('users')->getColumn('uuid')->getComment());
5453

5554
$products = $fluid->table('products');
5655
$graphqlField = $products->uuid()
5756
->column('user_id')->references('users')->graphqlField();
58-
$this->assertNotContains('outputType = "ID"', $schema->getTable('products')->getColumn('user_id')->getComment());
57+
$this->assertStringNotContainsString('outputType = "ID"', $schema->getTable('products')->getColumn('user_id')->getComment());
5958

6059
$this->assertSame('products', $graphqlField->then()->getDbalTable()->getName());
6160
}

0 commit comments

Comments
 (0)