Skip to content

Commit

Permalink
Merge branch 'feature/laravel11-support'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gandhi11 committed Apr 22, 2024
2 parents 5d898a6 + 137127a commit 4e9dc26
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 38 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ jobs:
fail-fast: true
matrix:
php: [8.1, 8.2, 8.3]
laravel: [10.*]
laravel: [10.*, 11.*]
dependency-version: [prefer-lowest, prefer-stable]
exclude:
- php: 8.1
laravel: 11.*
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*

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

Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
"require": {
"php": "^8.1",
"astrotomic/laravel-translatable": "^11.0",
"illuminate/contracts": "^10.0",
"illuminate/support": "^10.0",
"illuminate/routing": "^10.0",
"illuminate/translation": "^10.0"
"illuminate/contracts": "^10.0|^11.0",
"illuminate/support": "^10.0|^11.0",
"illuminate/routing": "^10.0|^11.0",
"illuminate/translation": "^10.0|^11.0"
},
"require-dev": {
"laravel/pint": "^1.2",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^8.0",
"phpunit/phpunit": "^9.3.3",
"orchestra/testbench": "^8.0|^9.0",
"phpunit/phpunit": "^10.5",
"squizlabs/php_codesniffer": "^3.6"
},
"suggest": {
Expand Down
25 changes: 12 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<source>
<include>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</include>
</source>
<php>
<env name="DB_CONNECTION" value="sqlite"/>
<ini name="DB_DATABASE" value=":memory:"/>
</php>
</phpunit>
32 changes: 16 additions & 16 deletions tests/Integration/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function testScopeWhereHasTranslationDefaultParameters(): void
});

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

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

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

Expand All @@ -73,8 +73,8 @@ public function testScopeWhereHasTranslationWithCallback(): void
});

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

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

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

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

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

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

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

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

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Exolnet\Translation\Tests\Unit;

class ExampleTest extends UnitTest
class ExampleTest extends UnitTestCase
{
public function testBasic()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/UnitTest.php → tests/Unit/UnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Mockery;
use PHPUnit\Framework\TestCase;

abstract class UnitTest extends TestCase
abstract class UnitTestCase extends TestCase
{
public function tearDown(): void
{
Expand Down

0 comments on commit 4e9dc26

Please sign in to comment.