-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UiTranslations] Add test application
- Loading branch information
Showing
21 changed files
with
316 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,33 @@ | ||
{ | ||
"name": "sylius/ui-translations", | ||
"description": "Basic UI translations", | ||
"type": "library", | ||
"require": { | ||
"php": "^8.1", | ||
"symfony/http-kernel": "^6.4 || ^7.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Sylius\\UiTranslations\\": "src/" | ||
"name": "sylius/ui-translations", | ||
"description": "Basic UI translations", | ||
"type": "library", | ||
"require": { | ||
"php": "^8.1", | ||
"symfony/translation": "^6.4 || ^7.0", | ||
"symfony/yaml": "^6.4 || ^7.0" | ||
}, | ||
"require-dev": { | ||
"symfony/console": "^6.4 || ^7.0", | ||
"symfony/dotenv": "^6.4 || ^7.0", | ||
"symfony/framework-bundle": "^6.4 || ^7.0", | ||
"symfony/http-kernel": "^6.4 || ^7.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Sylius\\UiTranslations\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"TestApplication\\Sylius\\UiTranslations\\": "tests/Functional/.application/src/", | ||
"Tests\\Sylius\\UiTranslations\\": "tests/" | ||
} | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"symfony/runtime": true | ||
}, | ||
"sort-packages": true | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tests\\Sylius\\UiTranslations\\": "tests/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# In all environments, the following files are loaded if they exist, | ||
# the latter taking precedence over the former: | ||
# | ||
# * .env contains default values for the environment variables needed by the app | ||
# * .env.local uncommitted file with local overrides | ||
# * .env.$APP_ENV committed environment-specific defaults | ||
# * .env.$APP_ENV.local uncommitted environment-specific overrides | ||
# | ||
# Real environment variables win over .env files. | ||
# | ||
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. | ||
# https://symfony.com/doc/current/configuration/secrets.html | ||
# | ||
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). | ||
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration | ||
|
||
###> symfony/framework-bundle ### | ||
APP_ENV=dev | ||
APP_SECRET=c9570eaa5cbfadf33ad1a93f95c2e42a | ||
###< symfony/framework-bundle ### |
12 changes: 12 additions & 0 deletions
12
src/UiTranslations/tests/Functional/.application/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
###> symfony/framework-bundle ### | ||
/.env.local | ||
/.env.local.php | ||
/.env.*.local | ||
/config/secrets/prod/prod.decrypt.private.php | ||
/public/bundles/ | ||
/var/ | ||
/vendor/ | ||
###< symfony/framework-bundle ### | ||
|
||
composer.lock |
21 changes: 21 additions & 0 deletions
21
src/UiTranslations/tests/Functional/.application/bin/console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use TestApplication\Sylius\UiTranslations\Kernel; | ||
|
||
$_SERVER['APP_RUNTIME_OPTIONS'] = [ | ||
'project_dir' => dirname(__DIR__), | ||
]; | ||
|
||
if (file_exists(dirname(__DIR__, 4).'/vendor/autoload_runtime.php')) { | ||
require_once dirname(__DIR__, 4).'/vendor/autoload_runtime.php'; | ||
} else { | ||
require_once dirname(__DIR__, 6).'/vendor/autoload_runtime.php'; | ||
} | ||
|
||
return function (array $context) { | ||
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); | ||
|
||
return new Application($kernel); | ||
}; |
36 changes: 36 additions & 0 deletions
36
src/UiTranslations/tests/Functional/.application/config/bootstrap.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Symfony\Component\Dotenv\Dotenv; | ||
|
||
if (file_exists(dirname(__DIR__, 4) . '/vendor/autoload.php')) { | ||
require_once dirname(__DIR__, 4) . '/vendor/autoload.php'; | ||
} else { | ||
require_once dirname(__DIR__, 6) . '/vendor/autoload.php'; | ||
} | ||
|
||
// Load cached env vars if the .env.local.php file exists | ||
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) | ||
if (is_array($env = @include dirname(__DIR__) . '/.env.local.php')) { | ||
$_SERVER += $env; | ||
$_ENV += $env; | ||
} elseif (!class_exists(Dotenv::class)) { | ||
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); | ||
} else { | ||
// load all the .env files | ||
(new Dotenv())->loadEnv(dirname(__DIR__) . '/.env'); | ||
} | ||
|
||
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; | ||
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; | ||
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; |
18 changes: 18 additions & 0 deletions
18
src/UiTranslations/tests/Functional/.application/config/bundles.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
return [ | ||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], | ||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], | ||
Sylius\UiTranslations\Symfony\SyliusUiTranslationsBundle::class => ['all' => true], | ||
]; |
19 changes: 19 additions & 0 deletions
19
src/UiTranslations/tests/Functional/.application/config/packages/cache.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
framework: | ||
cache: | ||
# Unique name of your app: used to compute stable namespaces for cache keys. | ||
#prefix_seed: your_vendor_name/app_name | ||
|
||
# The "app" cache stores to the filesystem by default. | ||
# The data in this cache should persist between deploys. | ||
# Other options include: | ||
|
||
# Redis | ||
#app: cache.adapter.redis | ||
#default_redis_provider: redis://localhost | ||
|
||
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues) | ||
#app: cache.adapter.apcu | ||
|
||
# Namespaced pools use the above "app" backend by default | ||
#pools: | ||
#my.dedicated.cache: null |
24 changes: 24 additions & 0 deletions
24
src/UiTranslations/tests/Functional/.application/config/packages/framework.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Symfony\Component\HttpKernel\Kernel; | ||
|
||
return static function (ContainerConfigurator $container): void { | ||
if (Kernel::MAJOR_VERSION >= 6) { | ||
$container->extension('framework', [ | ||
'handle_all_throwables' => true, | ||
]); | ||
} | ||
}; |
22 changes: 22 additions & 0 deletions
22
src/UiTranslations/tests/Functional/.application/config/packages/framework.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# see https://symfony.com/doc/current/reference/configuration/framework.html | ||
framework: | ||
secret: '%env(APP_SECRET)%' | ||
#csrf_protection: true | ||
http_method_override: false | ||
|
||
# Enables session support. Note that the session will ONLY be started if you read or write from it. | ||
# Remove or comment this section to explicitly disable session support. | ||
session: | ||
handler_id: null | ||
cookie_secure: auto | ||
cookie_samesite: lax | ||
storage_factory_id: session.storage.factory.native | ||
|
||
#esi: true | ||
#fragments: true | ||
|
||
when@test: | ||
framework: | ||
test: true | ||
session: | ||
storage_factory_id: session.storage.factory.mock_file |
12 changes: 12 additions & 0 deletions
12
src/UiTranslations/tests/Functional/.application/config/packages/routing.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
framework: | ||
router: | ||
utf8: true | ||
|
||
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands. | ||
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands | ||
#default_uri: http://localhost | ||
|
||
when@prod: | ||
framework: | ||
router: | ||
strict_requirements: null |
16 changes: 16 additions & 0 deletions
16
src/UiTranslations/tests/Functional/.application/config/preload.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
if (file_exists(dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php')) { | ||
require dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php'; | ||
} |
3 changes: 3 additions & 0 deletions
3
src/UiTranslations/tests/Functional/.application/config/routes.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#index: | ||
# path: / | ||
# controller: App\Controller\DefaultController::index |
4 changes: 4 additions & 0 deletions
4
src/UiTranslations/tests/Functional/.application/config/routes/framework.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
when@dev: | ||
_errors: | ||
resource: '@FrameworkBundle/Resources/config/routing/errors.xml' | ||
prefix: /_error |
24 changes: 24 additions & 0 deletions
24
src/UiTranslations/tests/Functional/.application/config/services.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This file is the entry point to configure your own services. | ||
# Files in the packages/ subdirectory configure your dependencies. | ||
|
||
# Put parameters here that don't need to change on each machine where the app is deployed | ||
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration | ||
parameters: | ||
|
||
services: | ||
# default configuration for services in *this* file | ||
_defaults: | ||
autowire: true # Automatically injects dependencies in your services. | ||
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. | ||
|
||
# makes classes in src/ available to be used as services | ||
# this creates a service per class whose id is the fully-qualified class name | ||
TestApplication\Sylius\UiTranslations\: | ||
resource: '../src/' | ||
exclude: | ||
- '../src/DependencyInjection/' | ||
- '../src/Entity/' | ||
- '../src/Kernel.php' | ||
|
||
# add more service definitions when explicit configuration is needed | ||
# please note that last definitions always *replace* previous ones |
24 changes: 24 additions & 0 deletions
24
src/UiTranslations/tests/Functional/.application/public/index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use TestApplication\Sylius\UiTranslations\Kernel; | ||
|
||
if (file_exists(dirname(__DIR__, 4) . '/vendor/autoload_runtime.php')) { | ||
require_once dirname(__DIR__, 4) . '/vendor/autoload_runtime.php'; | ||
} else { | ||
require_once dirname(__DIR__, 6) . '/vendor/autoload_runtime.php'; | ||
} | ||
|
||
return function (array $context) { | ||
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); | ||
}; |
Empty file.
27 changes: 27 additions & 0 deletions
27
src/UiTranslations/tests/Functional/.application/src/Kernel.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Sylius Sp. z o.o. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TestApplication\Sylius\UiTranslations; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | ||
use Symfony\Component\HttpKernel\Kernel as BaseKernel; | ||
|
||
class Kernel extends BaseKernel | ||
{ | ||
use MicroKernelTrait; | ||
|
||
public function getProjectDir(): string | ||
{ | ||
return dirname(__DIR__); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters