Skip to content

Commit

Permalink
Added parallel testing
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-helldar committed Jun 22, 2024
1 parent e2503ab commit 4dad9f1
Show file tree
Hide file tree
Showing 13 changed files with 335 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
* text=auto

.github/ export-ignore

workbench/ export-ignore
tests/ export-ignore

.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore

phpunit.php export-ignore
phpunit.xml export-ignore
testbench.yaml export-ignore
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
},
"autoload-dev": {
"psr-4": {
"App\\": "workbench/app/",
"Tests\\": "tests/"
}
},
Expand All @@ -74,7 +75,7 @@
},
"scripts": {
"test": [
"php vendor/bin/pest --compact"
"php vendor/bin/pest --parallel"
]
}
}
12 changes: 12 additions & 0 deletions testbench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
laravel: ./workbench
providers:
- LaravelLang\Config\ServiceProvider
- LaravelLang\Locales\ServiceProvider
workbench:
welcome: false
install: false
discovers:
web: false
api: false
commands: false
views: false
11 changes: 10 additions & 1 deletion tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@

declare(strict_types=1);

use DragonCode\Support\Facades\Filesystem\Directory;
use Orchestra\Testbench\Concerns\WithWorkbench;
use Tests\TestCase;

uses(TestCase::class)->in('Unit');
uses(TestCase::class, WithWorkbench::class)
->beforeEach(function () {
Directory::ensureDelete(lang_path());
Directory::ensureDirectory(lang_path());
})
->afterAll(function () {
Directory::ensureDelete(lang_path());
})->in('Unit');
23 changes: 0 additions & 23 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,8 @@

namespace Tests;

use DragonCode\Support\Facades\Filesystem\Directory;
use LaravelLang\Config\ServiceProvider as ConfigServiceProvider;
use LaravelLang\Locales\ServiceProvider;
use Orchestra\Testbench\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
protected function setUp(): void
{
parent::setUp();

$this->cleanUp();
}

protected function getPackageProviders($app): array
{
return [
ServiceProvider::class,
ConfigServiceProvider::class,
];
}

protected function cleanUp(): void
{
Directory::ensureDelete(lang_path());
Directory::ensureDirectory(lang_path());
}
}
2 changes: 2 additions & 0 deletions workbench/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lang/
vendor/
20 changes: 20 additions & 0 deletions workbench/app/Foundation/Application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace App\Foundation;

use Illuminate\Foundation\Application as BaseApplication;

class Application extends BaseApplication
{
public function langPath($path = ''): string
{
return $this->joinPaths($this->langPath, $this->parallelToken() . '/' . $path);
}

protected function parallelToken(): string
{
return $_SERVER['TEST_TOKEN'] ?? '0';
}
}
7 changes: 7 additions & 0 deletions workbench/bootstrap/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

declare(strict_types=1);

use App\Foundation\Application;

return Application::configure(basePath: dirname(__DIR__))->create();
Empty file.
2 changes: 2 additions & 0 deletions workbench/bootstrap/cache/packages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php return array (
);
232 changes: 232 additions & 0 deletions workbench/bootstrap/cache/services.php

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions workbench/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": [
"laravel",
"framework"
],
"license": "MIT",
"require": {
"php": "^8.2",
"laravel/framework": "^11.9"
},
"require-dev": {
"nunomaduro/collision": "^8.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
]
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
Empty file.

0 comments on commit 4dad9f1

Please sign in to comment.