Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow fix and tests update #173

Merged
merged 30 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
be19111
added .idea folder into .gitignore
Jul 19, 2024
57f6f6b
added .phpunit.cache folder into .gitignore
Jul 19, 2024
04024e7
phpunit.xml.dist schema updated
Jul 19, 2024
caf72c8
code style
Jul 19, 2024
188967c
PHPUnit replaced by Pest
Jul 19, 2024
6a62ee8
Tests refactoring
Jul 19, 2024
cfd30e9
PHP 8.0 compatibility
Jul 19, 2024
450db0d
github test runner fixed
Jul 19, 2024
9e4153b
PHP CS Fixer added and reconfigured
Jul 19, 2024
2e60a98
PHP CS Fixer configuration rules fix
Jul 19, 2024
83e3070
PHP CS Fixer configuration rules fixed
Jul 19, 2024
df9b024
Update composer.json
Jul 22, 2024
a3d8682
Update composer.json and run-tests.yml
Jul 22, 2024
394e2af
Revert "Update composer.json and run-tests.yml"
Jul 22, 2024
a5d5cc2
Update composer.json
Jul 22, 2024
ee48bd4
removed unused migration
Jul 22, 2024
5cce48e
removed constants and comments in test files
Jul 22, 2024
e03d396
removed DOCBlocks form Pest.php
Jul 22, 2024
9c5f657
removed declare(strict_types=1);
Jul 22, 2024
0fa8621
Fix styling
aon4o Jul 22, 2024
3b436f8
package ServiceProvider updated with spatie/laravel-package-tools
aon4o Jul 22, 2024
42f1b7f
updated README.md
aon4o Jul 22, 2024
76e2d5b
Fix Laravel 8 compatibility
aon4o Jul 22, 2024
b077803
grammar fix README.md
aon4o Jul 22, 2024
57e03e4
Translation loading fix
aon4o Jul 25, 2024
a43c7b5
Fix styling
aon4o Jul 25, 2024
13f0c83
Revert "Fix styling"
aon4o Jul 25, 2024
d8025b4
Revert "Translation loading fix"
aon4o Jul 25, 2024
fd3d116
$this->app['config'] -> config()
aon4o Aug 26, 2024
f0ced13
Merge branch 'main' into main
aon4o Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Check & fix styling

on: [push]
on: [ push ]

jobs:
style:
Expand All @@ -13,7 +13,7 @@ jobs:
- name: Fix style
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php_cs --allow-risky=yes
args: --config=.php-cs-fixer.php --allow-risky=yes

- name: Extract branch name
shell: bash
Expand Down
98 changes: 49 additions & 49 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
name: run-tests

on:
- push
- pull_request
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.2, 8.1, 8.0]
laravel: ['8.*', '9.*', '10.*', '11.*']
dependency-version: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: 6.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 11.*
php: 8.0

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

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "nesbot/carbon:^2.63" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit
test:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
php: [ 8.2, 8.1, 8.0 ]
laravel: [ '8.*', '9.*', '10.*', '11.*' ]
dependency-version: [ prefer-stable ]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: 6.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 11.*
php: 8.0

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

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "nesbot/carbon:^2.63" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Execute tests
run: composer test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ build
composer.lock
docs
vendor
.php_cs.cache
.php-cs-fixer.cache
.phpunit.cache
.phpunit.result.cache
.idea
32 changes: 25 additions & 7 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

$finder = Symfony\Component\Finder\Finder::create()
->notPath('bootstrap/*')
->notPath('storage/*')
Expand All @@ -13,30 +15,46 @@
->ignoreDotFiles(true)
->ignoreVCS(true);

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
'array_syntax' => [
'syntax' => 'short',
],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
],
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => [
'elements' => [
'arrays',
],
],
'phpdoc_scalar' => true,
'unary_operator_spaces' => true,
'binary_operator_spaces' => true,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
'statements' => [
'break',
'continue',
'declare',
'return',
'throw',
'try',
],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'class_attributes_separation' => [
'elements' => [
'method', 'property',
'method' => 'one',
'property' => 'one',
],
],
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => true,
]
],
])
->setFinder($finder);
17 changes: 11 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
}
],
"require": {
"php": "^7.2|^8.0",
"php": "^8.0",
"illuminate/translation": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.0|^10.5",
"orchestra/testbench": "^4.0|^5.0|^6.0|^7.0|^8.0|^9.0"
"friendsofphp/php-cs-fixer": "^3.59",
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
"pestphp/pest": "^1.23|^2.0"
},
"autoload": {
"psr-4": {
Expand All @@ -36,14 +37,18 @@
},
"autoload-dev": {
"psr-4": {
"Spatie\\TranslationLoader\\Test\\": "tests"
"Tests\\": "tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit"
"test": "vendor/bin/pest",
"lint": "vendor/bin/php-cs-fixer fix"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"laravel": {
Expand Down
2 changes: 2 additions & 0 deletions config/translation-loader.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [

/*
Expand Down
2 changes: 1 addition & 1 deletion database/migrations/create_language_lines_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('language_lines', function (Blueprint $table) {
$table->bigIncrements('id');
$table->id();
$table->string('group')->index();
$table->string('key');
$table->json('text');
Expand Down
29 changes: 29 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheDirectory=".phpunit.cache"
>
<coverage>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
<testsuites>
<testsuite name="Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>./app</directory>
<directory>./src</directory>
</include>
</source>
</phpunit>
29 changes: 0 additions & 29 deletions phpunit.xml.dist

This file was deleted.

6 changes: 4 additions & 2 deletions src/Exceptions/InvalidConfiguration.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Spatie\TranslationLoader\Exceptions;

use Exception;
Expand All @@ -9,7 +11,7 @@ class InvalidConfiguration extends Exception
{
public static function invalidModel(string $className): self
{
return new static("You have configured an invalid class `{$className}`.".
'A valid class extends '.LanguageLine::class.'.');
return new static("You have configured an invalid class `{$className}`." .
'A valid class extends ' . LanguageLine::class . '.');
}
}
Loading
Loading