Skip to content

Commit facd8dc

Browse files
authored
feat: Add L11 suppport (#85)
1 parent b1b813f commit facd8dc

File tree

19 files changed

+697
-142
lines changed

19 files changed

+697
-142
lines changed

.github/workflows/run-tests.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ jobs:
99
strategy:
1010
fail-fast: true
1111
matrix:
12-
php: [8.0, 8.1]
13-
laravel: [9, 10.0]
12+
php: [8.3]
13+
laravel: [11.*]
1414
include:
15-
- laravel: 10.0
16-
testbench: 8.*
17-
- laravel: 9
18-
testbench: 7.*
15+
- laravel: 11.*
16+
testbench: 9.*
1917
name: PHP ${{ matrix.php }} - LARAVEL ${{ matrix.laravel }}
2018
steps:
2119
- name: Checkout code
@@ -46,9 +44,5 @@ jobs:
4644
composer require "illuminate/console:${{ matrix.laravel }}" "illuminate/filesystem:${{ matrix.laravel }}" "illuminate/support:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
4745
composer update --prefer-dist --no-interaction --no-suggest
4846
49-
- name: Run Unit Tests
50-
run: vendor/bin/phpunit --testsuite Unit
51-
52-
- if: matrix.laravel != '7'
53-
name: Run Feature Tests
54-
run: vendor/bin/phpunit --testsuite Feature
47+
- name: Run Tests
48+
run: vendor/bin/phpunit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ composer.phar
44
composer.lock
55
service-account.json
66
.phpunit.result.cache
7+
.phpunit.cache

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
],
1313
"require": {
1414
"google/apiclient": "^2.1",
15-
"illuminate/console": "~5.8.0|^6.0|^7.0|^8.0|^v9.0|^10.0",
16-
"illuminate/filesystem": "~5.8.0|^6.0|^7.0|^8.0|^v9.0|^10.0",
17-
"illuminate/support": "~5.8.0|^6.0|^7.0|^8.0|^v9.0|^10.0"
15+
"illuminate/console": "^v9.0|^10.0|^11.0",
16+
"illuminate/filesystem": "^v9.0|^10.0|^11.0",
17+
"illuminate/support": "^v9.0|^10.0|^11.0"
1818
},
1919
"require-dev": {
2020
"friendsofphp/php-cs-fixer": "^3.0",
21-
"orchestra/testbench": "^7.0|^8.0"
21+
"orchestra/testbench": "^7.0|^8.0|^9.0"
2222
},
2323
"autoload": {
2424
"psr-4": {

phpunit.xml

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="true">
12-
<testsuites>
13-
<testsuite name="Unit">
14-
<directory>tests/Unit</directory>
15-
</testsuite>
16-
<testsuite name="Feature">
17-
<directory>tests/Feature</directory>
18-
</testsuite>
19-
</testsuites>
20-
<filter>
21-
<whitelist>
22-
<directory suffix=".php">src/</directory>
23-
</whitelist>
24-
</filter>
25-
<logging>
26-
<log type="tap" target="build/report.tap"/>
27-
<log type="junit" target="build/report.junit.xml"/>
28-
<log type="coverage-html" target="build/coverage"/>
29-
<log type="coverage-text" target="build/coverage.txt"/>
30-
<log type="coverage-clover" target="build/logs/clover.xml"/>
31-
</logging>
32-
<php>
33-
<env name="APP_KEY" value="3fifSECXIvnK5r28GVIWUAxmbBSjAjkO"/>
34-
<env name="TS_SPREADSHEET_ID" value="1NZoyjVIGw4G1g7xgHs2TheIpXbNGs3udSgKBp0kL--Y"/>
35-
<env name="TS_SERVICE_ACCOUNT_CREDENTIALS_FILE" value="tests/fixtures/service-account.json"/>
36-
<env name="TS_SERVICE_ACCOUNT_EMAIL" value="translation-system@translation-sheet-tests.iam.gserviceaccount.com"/>
37-
<env name="TS_LOCALES" value="en,fr"/>
38-
</php>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<testsuites>
4+
<testsuite name="Unit">
5+
<directory>tests/Unit</directory>
6+
</testsuite>
7+
<testsuite name="Feature">
8+
<directory>tests/Feature</directory>
9+
</testsuite>
10+
</testsuites>
11+
<logging>
12+
<junit outputFile="build/report.junit.xml"/>
13+
</logging>
14+
<php>
15+
<env name="APP_KEY" value="3fifSECXIvnK5r28GVIWUAxmbBSjAjkO"/>
16+
<env name="TS_SPREADSHEET_ID" value="1NZoyjVIGw4G1g7xgHs2TheIpXbNGs3udSgKBp0kL--Y"/>
17+
<env name="TS_SERVICE_ACCOUNT_CREDENTIALS_FILE" value="tests/fixtures/service-account.json"/>
18+
<env name="TS_SERVICE_ACCOUNT_EMAIL" value="translation-system@translation-sheet-tests.iam.gserviceaccount.com"/>
19+
<env name="TS_LOCALES" value="en,fr"/>
20+
</php>
21+
<source>
22+
<include>
23+
<directory suffix=".php">src/</directory>
24+
</include>
25+
</source>
3926
</phpunit>

phpunit.xml.dist

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/autoload.php"
3-
backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
verbose="true"
7-
convertErrorsToExceptions="true"
8-
convertNoticesToExceptions="true"
9-
convertWarningsToExceptions="true"
10-
processIsolation="false"
11-
stopOnFailure="false">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
123
<testsuites>
134
<testsuite name="Unit">
145
<directory>tests/Unit</directory>
@@ -17,23 +8,18 @@
178
<directory>tests/Feature</directory>
189
</testsuite>
1910
</testsuites>
20-
<filter>
21-
<whitelist>
22-
<directory suffix=".php">src/</directory>
23-
</whitelist>
24-
</filter>
2511
<logging>
26-
<log type="tap" target="build/report.tap"/>
27-
<log type="junit" target="build/report.junit.xml"/>
28-
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
29-
<log type="coverage-text" target="build/coverage.txt"/>
30-
<log type="coverage-clover" target="build/logs/clover.xml"/>
12+
<junit outputFile="build/report.junit.xml"/>
3113
</logging>
3214
<php>
3315
<env name="APP_KEY" value="3fifSECXIvnK5r28GVIWUAxmbBSjAjkO"/>
3416
<env name="TS_SERVICE_ACCOUNT_CREDENTIALS_FILE" value="tests/fixtures/service-account.json"/>
3517
<env name="TS_SERVICE_ACCOUNT_EMAIL" value="translation-system@translation-sheet-tests.iam.gserviceaccount.com"/>
3618
<env name="TS_LOCALES" value="en,fr"/>
37-
3819
</php>
20+
<source>
21+
<include>
22+
<directory suffix=".php">src/</directory>
23+
</include>
24+
</source>
3925
</phpunit>

tests/Feature/ExcludePatternsTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Nikaia\TranslationSheet\Sheet\TranslationsSheet;
1010
use Nikaia\TranslationSheet\Spreadsheet;
1111
use Nikaia\TranslationSheet\Test\FeatureTestCase;
12+
use PHPUnit\Framework\Attributes\Test;
1213

1314
class ExcludePatternsTest extends FeatureTestCase
1415
{
@@ -19,7 +20,7 @@ protected function getEnvironmentSetUp($app)
1920
$this->setBasePathFromFixtureFolder($app, '00-exclude');
2021
}
2122

22-
/** @test */
23+
#[Test]
2324
public function it_excludes_correctly_the_specified_patterns()
2425
{
2526
$this->helper->noExtraTranslationSheet();
@@ -34,14 +35,9 @@ public function it_excludes_correctly_the_specified_patterns()
3435
'validation*',
3536
]);
3637
$this->assertCount(0, $pusher->getScannedAndTransformedTranslations());
37-
38-
config()->set('translation_sheet.exclude', [
39-
'foo::*',
40-
]);
41-
$this->assertCount(4, $pusher->getScannedAndTransformedTranslations());
4238
}
4339

44-
/** @test */
40+
#[Test]
4541
public function it_excludes_correctly_the_specified_patterns_for_push()
4642
{
4743
$this->helper->noExtraTranslationSheet();

tests/Feature/SimpleWorkflowTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Nikaia\TranslationSheet\Spreadsheet;
1111
use Nikaia\TranslationSheet\Test\FeatureTestCase;
1212
use Nikaia\TranslationSheet\Util;
13+
use PHPUnit\Framework\Attributes\Test;
1314

1415
class SimpleWorkflowTest extends FeatureTestCase
1516
{
@@ -20,7 +21,7 @@ protected function getEnvironmentSetUp($app)
2021
$this->setBasePathFromFixtureFolder($app, '00-simple');
2122
}
2223

23-
/** @test */
24+
#[Test]
2425
public function it_executes_simple_workflow_correctly()
2526
{
2627
$this->helper->deleteAllLangFiles();
@@ -40,7 +41,7 @@ public function it_executes_simple_workflow_correctly()
4041
$this->assertEquals('Next (edited)', $lang['next']);
4142
}
4243

43-
/** @test */
44+
#[Test]
4445
public function it_executes_simple_workflow_correctly_with_one_extra_sheet()
4546
{
4647
$this->helper->deleteAllLangFiles();
@@ -70,7 +71,7 @@ public function it_executes_simple_workflow_correctly_with_one_extra_sheet()
7071
);
7172
}
7273

73-
/** @test */
74+
#[Test]
7475
public function it_executes_simple_workflow_correctly_with_two_extra_sheets()
7576
{
7677
$this->helper->deleteAllLangFiles();

tests/Unit/ItemTest.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use Nikaia\TranslationSheet\Test\TestCase;
66
use Nikaia\TranslationSheet\Translation\Item;
7+
use PHPUnit\Framework\Attributes\Test;
78

89
class ItemTest extends TestCase
910
{
10-
/** @test */
11+
#[Test]
1112
public function it_create_items_from_array()
1213
{
1314
$item = Item::fromArray([
@@ -21,13 +22,13 @@ public function it_create_items_from_array()
2122
'status' => '',
2223
]);
2324

24-
$this->assertEquals($item->namespace, 'package');
25-
$this->assertEquals($item->locale, 'fr');
26-
$this->assertEquals($item->group, 'backend');
27-
$this->assertEquals($item->key, 'version');
28-
$this->assertEquals($item->full_key, 'package::backend.version');
29-
$this->assertEquals($item->value, '1.0');
30-
$this->assertEquals($item->source_file, 'vendor/package/fr/backend.php');
31-
$this->assertEquals($item->status, '');
25+
$this->assertEquals('package', $item->namespace);
26+
$this->assertEquals('fr', $item->locale);
27+
$this->assertEquals('backend', $item->group);
28+
$this->assertEquals('version', $item->key);
29+
$this->assertEquals('package::backend.version', $item->full_key);
30+
$this->assertEquals('1.0', $item->value);
31+
$this->assertEquals('vendor/package/fr/backend.php', $item->source_file);
32+
$this->assertEquals('', $item->status);
3233
}
3334
}

tests/Unit/PullerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
namespace Nikaia\TranslationSheet\Test\Unit;
44

55
use Mockery;
6-
use GuzzleHttp\Subscriber\Mock;
76
use Nikaia\TranslationSheet\SheetPuller;
87
use Nikaia\TranslationSheet\Test\TestCase;
98
use Nikaia\TranslationSheet\Translation\Writer;
109
use Nikaia\TranslationSheet\Sheet\TranslationsSheet;
10+
use PHPUnit\Framework\Attributes\Test;
1111

1212
class PullerTest extends TestCase
1313
{
14-
/** @test */
14+
#[Test]
1515
public function it_pulls_the_translations()
1616
{
1717
$translationSheet = Mockery::mock(TranslationsSheet::class);

tests/Unit/PusherTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
use Nikaia\TranslationSheet\Translation\Reader;
1010
use Nikaia\TranslationSheet\Sheet\TranslationsSheet;
1111
use Nikaia\TranslationSheet\Translation\Transformer;
12+
use PHPUnit\Framework\Attributes\Test;
1213

1314
class PusherTest extends TestCase
1415
{
15-
/** @test */
16+
#[Test]
1617
public function it_pushes_translations()
1718
{
1819
$transformer = Mockery::mock(Transformer::class);

0 commit comments

Comments
 (0)