Skip to content

Commit 4e9dc26

Browse files
committed
Merge branch 'feature/laravel11-support'
2 parents 5d898a6 + 137127a commit 4e9dc26

File tree

6 files changed

+42
-38
lines changed

6 files changed

+42
-38
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ jobs:
1010
fail-fast: true
1111
matrix:
1212
php: [8.1, 8.2, 8.3]
13-
laravel: [10.*]
13+
laravel: [10.*, 11.*]
1414
dependency-version: [prefer-lowest, prefer-stable]
15+
exclude:
16+
- php: 8.1
17+
laravel: 11.*
1518
include:
1619
- laravel: 10.*
1720
testbench: 8.*
21+
- laravel: 11.*
22+
testbench: 9.*
1823

1924
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
2025

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@
2525
"require": {
2626
"php": "^8.1",
2727
"astrotomic/laravel-translatable": "^11.0",
28-
"illuminate/contracts": "^10.0",
29-
"illuminate/support": "^10.0",
30-
"illuminate/routing": "^10.0",
31-
"illuminate/translation": "^10.0"
28+
"illuminate/contracts": "^10.0|^11.0",
29+
"illuminate/support": "^10.0|^11.0",
30+
"illuminate/routing": "^10.0|^11.0",
31+
"illuminate/translation": "^10.0|^11.0"
3232
},
3333
"require-dev": {
3434
"laravel/pint": "^1.2",
3535
"mockery/mockery": "^1.4",
36-
"orchestra/testbench": "^8.0",
37-
"phpunit/phpunit": "^9.3.3",
36+
"orchestra/testbench": "^8.0|^9.0",
37+
"phpunit/phpunit": "^10.5",
3838
"squizlabs/php_codesniffer": "^3.6"
3939
},
4040
"suggest": {

phpunit.xml.dist

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
55
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
6+
>
127
<testsuites>
138
<testsuite name="Test Suite">
149
<directory>tests</directory>
1510
</testsuite>
1611
</testsuites>
17-
<filter>
18-
<whitelist>
12+
<source>
13+
<include>
1914
<directory suffix=".php">src/</directory>
20-
</whitelist>
21-
</filter>
15+
</include>
16+
</source>
17+
<php>
18+
<env name="DB_CONNECTION" value="sqlite"/>
19+
<ini name="DB_DATABASE" value=":memory:"/>
20+
</php>
2221
</phpunit>

tests/Integration/ModelTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public function testScopeWhereHasTranslationDefaultParameters(): void
2929
});
3030

3131
$this->assertEquals(
32-
'select * from `examples` where exists (select * from `example_translations` where ' .
33-
'`examples`.`id` = `example_translations`.`example_id` and `locale` = ?)',
32+
'select * from "examples" where exists (select * from "example_translations" where ' .
33+
'"examples"."id" = "example_translations"."example_id" and "locale" = ?)',
3434
$query->toSql()
3535
);
3636

@@ -51,8 +51,8 @@ public function testScopeWhereHasTranslationWithParameters(): void
5151
}, 'fr', '>', 2);
5252

5353
$this->assertEquals(
54-
'select * from `examples` where (select count(*) from `example_translations` where ' .
55-
'`examples`.`id` = `example_translations`.`example_id` and `locale` = ?) > 2',
54+
'select * from "examples" where (select count(*) from "example_translations" where ' .
55+
'"examples"."id" = "example_translations"."example_id" and "locale" = ?) > 2',
5656
$query->toSql()
5757
);
5858

@@ -73,8 +73,8 @@ public function testScopeWhereHasTranslationWithCallback(): void
7373
});
7474

7575
$this->assertEquals(
76-
'select * from `examples` where exists (select * from `example_translations` where ' .
77-
'`examples`.`id` = `example_translations`.`example_id` and `locale` = ? and `description` like ?)',
76+
'select * from "examples" where exists (select * from "example_translations" where ' .
77+
'"examples"."id" = "example_translations"."example_id" and "locale" = ? and "description" like ?)',
7878
$query->toSql()
7979
);
8080

@@ -93,8 +93,8 @@ public function testScopeHasTranslation(): void
9393
$query = Example::query()->HasTranslation('description', 'test', 'fr', 'like');
9494

9595
$this->assertEquals(
96-
'select * from `examples` where exists (select * from `example_translations` where ' .
97-
'`examples`.`id` = `example_translations`.`example_id` and `locale` = ? and `description` like ?)',
96+
'select * from "examples" where exists (select * from "example_translations" where ' .
97+
'"examples"."id" = "example_translations"."example_id" and "locale" = ? and "description" like ?)',
9898
$query->toSql()
9999
);
100100

@@ -113,8 +113,8 @@ public function testScopeWhereTranslation(): void
113113
$query = Example::query()->WhereTranslation('name', 'like', 'name1', 'fr');
114114

115115
$this->assertEquals(
116-
'select * from `examples` where exists (select * from `example_translations` where ' .
117-
'`examples`.`id` = `example_translations`.`example_id` and `locale` = ? and `name` like ?)',
116+
'select * from "examples" where exists (select * from "example_translations" where ' .
117+
'"examples"."id" = "example_translations"."example_id" and "locale" = ? and "name" like ?)',
118118
$query->toSql()
119119
);
120120

@@ -133,8 +133,8 @@ public function testScopeWhereTranslationMixedValue(): void
133133
$query = Example::query()->WhereTranslation('name', '>=', '2', 'fr');
134134

135135
$this->assertEquals(
136-
'select * from `examples` where exists (select * from `example_translations` where ' .
137-
'`examples`.`id` = `example_translations`.`example_id` and `locale` = ? and `name` >= ?)',
136+
'select * from "examples" where exists (select * from "example_translations" where ' .
137+
'"examples"."id" = "example_translations"."example_id" and "locale" = ? and "name" >= ?)',
138138
$query->toSql()
139139
);
140140

@@ -153,8 +153,8 @@ public function testScopeJoinTranslation(): void
153153
$query = Example::query()->JoinTranslation();
154154

155155
$this->assertEquals(
156-
'select * from `examples` left join `example_translations` on ' .
157-
'`example_translations`.`example_id` = `examples`.`id` where `example_translations`.`locale` = ?',
156+
'select * from "examples" left join "example_translations" on ' .
157+
'"example_translations"."example_id" = "examples"."id" where "example_translations"."locale" = ?',
158158
$query->toSql()
159159
);
160160

@@ -173,8 +173,8 @@ public function testScopeJoinTranslationWithLocaleParameter(): void
173173
$query = Example::query()->JoinTranslation('fr');
174174

175175
$this->assertEquals(
176-
'select * from `examples` left join `example_translations` on ' .
177-
'`example_translations`.`example_id` = `examples`.`id` where `example_translations`.`locale` = ?',
176+
'select * from "examples" left join "example_translations" on ' .
177+
'"example_translations"."example_id" = "examples"."id" where "example_translations"."locale" = ?',
178178
$query->toSql()
179179
);
180180

tests/Unit/ExampleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Exolnet\Translation\Tests\Unit;
44

5-
class ExampleTest extends UnitTest
5+
class ExampleTest extends UnitTestCase
66
{
77
public function testBasic()
88
{

tests/Unit/UnitTest.php renamed to tests/Unit/UnitTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Mockery;
66
use PHPUnit\Framework\TestCase;
77

8-
abstract class UnitTest extends TestCase
8+
abstract class UnitTestCase extends TestCase
99
{
1010
public function tearDown(): void
1111
{

0 commit comments

Comments
 (0)