Skip to content

Commit e0b57b1

Browse files
authored
Merge pull request #13 from aszenz/master
ci: Improve tests + fix ci deps
2 parents d7155ca + eb7b229 commit e0b57b1

File tree

5 files changed

+47
-51
lines changed

5 files changed

+47
-51
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ jobs:
2020
dependencies:
2121
- "lowest"
2222
- "highest"
23-
exclude:
24-
# Exclude lowest deps version as they don't support newer php versions
25-
- dependencies: "lowest"
26-
php-version: "8.3"
27-
- dependencies: "lowest"
28-
php-version: "8.2"
29-
- dependencies: "lowest"
30-
php-version: "8.1"
3123

3224
steps:
3325
- name: "Checkout"
@@ -48,6 +40,9 @@ jobs:
4840
run: "vendor/bin/phpunit -c phpunit.xml.dist"
4941

5042
- name: Upload coverage results to Coveralls
43+
# skip php-coversalls for lowest deps
44+
# it fails on lowest depedencies because old versions of guzzle doesn't work well with newer php versions
45+
if: "${{ 'highest' == matrix.dependencies }}"
5146
env:
5247
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5348
run: |

composer.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"require": {
1212
"php": "^7.4 || ^8.0",
1313
"doctrine/dbal": "^3.0",
14-
"doctrine/inflector": "^1.0 || ^2.0"
14+
"doctrine/inflector": "^1.4 || ^2.0"
1515
},
1616
"require-dev": {
1717
"phpunit/phpunit": "^10.2",
18-
"php-coveralls/php-coveralls": "^2.0.0"
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.4.x-dev"
35-
}
36-
}
31+
"prefer-stable": true
3732
}

src/FluidColumn.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public function dateInterval(): FluidColumnOptions
180180
}
181181

182182
/**
183-
* @depracated Use json() instead
183+
* @deprecated Use json() instead
184184
*/
185185
public function array(): FluidColumnOptions
186186
{
@@ -211,7 +211,7 @@ public function jsonArray(): FluidColumnOptions
211211
}
212212

213213
/**
214-
* @depracated Use json() instead
214+
* @deprecated Use json() instead
215215
*/
216216
public function object(): FluidColumnOptions
217217
{

tests/FluidColumnTest.php

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,36 +80,31 @@ public function testTypes()
8080
$column->object();
8181
$this->assertSame(Type::getType(Types::OBJECT), $dbalColumn->getType());
8282

83-
if (defined('Doctrine\\DBAL\\Types\\Types::BINARY')) {
84-
$column->binary(43);
85-
$this->assertSame(Type::getType(Types::BINARY), $dbalColumn->getType());
86-
$this->assertSame(43, $dbalColumn->getLength());
87-
$this->assertSame(false, $dbalColumn->getFixed());
88-
}
83+
$column->binary(43);
84+
$this->assertSame(Type::getType(Types::BINARY), $dbalColumn->getType());
85+
$this->assertSame(43, $dbalColumn->getLength());
86+
$this->assertSame(false, $dbalColumn->getFixed());
8987

90-
if (defined('Doctrine\\DBAL\\Types\\Types::DATE_IMMUTABLE')) {
91-
// Doctrine DBAL 2.6+
92-
$column->dateImmutable();
93-
$this->assertSame(Type::getType('date_immutable'), $dbalColumn->getType());
88+
$column->dateImmutable();
89+
$this->assertSame(Type::getType('date_immutable'), $dbalColumn->getType());
9490

95-
$column->datetimeImmutable();
96-
$this->assertSame(Type::getType(Types::DATETIME_IMMUTABLE), $dbalColumn->getType());
91+
$column->datetimeImmutable();
92+
$this->assertSame(Type::getType(Types::DATETIME_IMMUTABLE), $dbalColumn->getType());
9793

98-
$column->datetimeTzImmutable();
99-
$this->assertSame(Type::getType(Types::DATETIMETZ_IMMUTABLE), $dbalColumn->getType());
94+
$column->datetimeTzImmutable();
95+
$this->assertSame(Type::getType(Types::DATETIMETZ_IMMUTABLE), $dbalColumn->getType());
10096

101-
$column->time();
102-
$this->assertSame(Type::getType(Types::TIME_MUTABLE), $dbalColumn->getType());
97+
$column->time();
98+
$this->assertSame(Type::getType(Types::TIME_MUTABLE), $dbalColumn->getType());
10399

104-
$column->timeImmutable();
105-
$this->assertSame(Type::getType(Types::TIME_IMMUTABLE), $dbalColumn->getType());
100+
$column->timeImmutable();
101+
$this->assertSame(Type::getType(Types::TIME_IMMUTABLE), $dbalColumn->getType());
106102

107-
$column->dateInterval();
108-
$this->assertSame(Type::getType(Types::DATEINTERVAL), $dbalColumn->getType());
103+
$column->dateInterval();
104+
$this->assertSame(Type::getType(Types::DATEINTERVAL), $dbalColumn->getType());
109105

110-
$column->json();
111-
$this->assertSame(Type::getType(Types::JSON), $dbalColumn->getType());
112-
}
106+
$column->json();
107+
$this->assertSame(Type::getType(Types::JSON), $dbalColumn->getType());
113108

114109
$this->assertSame('foo', $column->getDbalColumn()->getName());
115110
}

tests/FluidTableTest.php

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,15 @@ public function testUuid()
102102

103103
public function testTimestamps()
104104
{
105-
if (defined('Doctrine\\DBAL\\Types\\Types::DATE_IMMUTABLE')) {
106-
$schema = new Schema();
107-
$fluid = new FluidSchema($schema);
105+
$schema = new Schema();
106+
$fluid = new FluidSchema($schema);
108107

109-
$posts = $fluid->table('posts');
108+
$posts = $fluid->table('posts');
110109

111-
$posts->timestamps();
110+
$posts->timestamps();
112111

113-
$this->assertTrue($schema->getTable('posts')->hasColumn('created_at'));
114-
$this->assertTrue($schema->getTable('posts')->hasColumn('updated_at'));
115-
} else {
116-
$this->markTestSkipped("Only available from Doctrine DBAL 2.6");
117-
}
112+
$this->assertTrue($schema->getTable('posts')->hasColumn('created_at'));
113+
$this->assertTrue($schema->getTable('posts')->hasColumn('updated_at'));
118114
}
119115

120116
public function testInherits()
@@ -138,6 +134,21 @@ public function testInherits()
138134
$this->assertSame(['id'], $fk->getLocalColumns());
139135
}
140136

137+
public function testCannotInheritFromATableWithMultiplePrimaryKeys()
138+
{
139+
$schema = new Schema();
140+
$fluid = new FluidSchema($schema);
141+
142+
$contacts = $fluid->table('contacts');
143+
$contacts->column('foo')->string();
144+
$contacts->column('bar')->string();
145+
$contacts->primaryKey(['foo', 'bar']);
146+
147+
$this->expectException(FluidSchemaException::class);
148+
149+
$fluid->table('users')->extends('contacts');
150+
}
151+
141152
public function testGetDbalTable()
142153
{
143154
$schema = new Schema();

0 commit comments

Comments
 (0)