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

Setup the fixtures for the Symfony support #271

Merged
merged 13 commits into from
Oct 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/fixtures/set004/scoper.inc.php
/fixtures/*/.box_dump/
/fixtures/*/vendor/
/fixtures/set028-symfony/expected-output
.phpunit*
/vendor/
/vendor-bin/*/vendor/
Expand Down
28 changes: 26 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tm: bin/phpunit

.PHONY: e2e
e2e: ## Run end-to-end tests
e2e: e2e_004 e2e_005 e2e_011 e2e_013 e2e_014 e2e_015 e2e_016 e2e_017 e2e_018 e2e_019 e2e_020 e2e_021 e2e_022 e2e_023 e2e_024 e2e_025 e2e_026 e2e_027
e2e: e2e_004 e2e_005 e2e_011 e2e_013 e2e_014 e2e_015 e2e_016 e2e_017 e2e_018 e2e_019 e2e_020 e2e_021 e2e_022 e2e_023 e2e_024 e2e_025 e2e_026 e2e_027 e2e_028

PHPSCOPER=bin/php-scoper.phar

Expand Down Expand Up @@ -282,7 +282,6 @@ e2e_026: bin/php-scoper.phar fixtures/set026/vendor
php build/set026/main.php > build/set026/output
diff fixtures/set026/expected-output build/set026/output


.PHONY: e2e_027
e2e_027: ## Run end-to-end tests for the fixture set 027 — Laravel
e2e_027: bin/php-scoper.phar fixtures/set027-laravel/vendor
Expand All @@ -298,6 +297,24 @@ e2e_027: bin/php-scoper.phar fixtures/set027-laravel/vendor
php build/set027-laravel/artisan -V > build/set027-laravel/output
diff fixtures/set027-laravel/expected-output build/set027-laravel/output

.PHONY: e2e_028
e2e_028: ## Run end-to-end tests for the fixture set 028 — Symfony
e2e_028: bin/php-scoper.phar fixtures/set028-symfony/vendor
php $(PHPSCOPER) add-prefix \
--working-dir=fixtures/set028-symfony \
--output-dir=../../build/set028-symfony \
--no-config \
--force \
--no-interaction \
--stop-on-failure

APP_ENV=dev composer --working-dir=fixtures/set028-symfony dump-autoload --no-dev
APP_ENV=dev php fixtures/set028-symfony/bin/console -V > fixtures/set028-symfony/expected-output

APP_ENV=dev composer --working-dir=build/set028-symfony dump-autoload --no-dev
APP_ENV=dev php build/set028-symfony/bin/console -V > build/set028-symfony/output

diff fixtures/set028-symfony/expected-output build/set028-symfony/output

.PHONY: tb
BLACKFIRE=blackfire
Expand Down Expand Up @@ -396,6 +413,10 @@ fixtures/set027-laravel/vendor: fixtures/set027-laravel/composer.lock
composer --working-dir=fixtures/set027-laravel install --no-dev
touch $@

fixtures/set028-symfony/vendor: fixtures/set028-symfony/composer.lock
composer --working-dir=fixtures/set028-symfony install --no-dev --no-scripts
touch $@

composer.lock: composer.json
@echo composer.lock is not up to date.

Expand Down Expand Up @@ -444,6 +465,9 @@ fixtures/set025/composer.lock: fixtures/set025/composer.json
fixtures/set027-laravel/composer.lock: fixtures/set027-laravel/composer.json
@echo fixtures/set027-laravel/composer.lock is not up to date.

fixtures/set028-symfony/composer.lock: fixtures/set028-symfony/composer.json
@echo fixtures/set028-symfony/composer.lock is not up to date.

bin/php-scoper.phar: bin/php-scoper src vendor scoper.inc.php box.json.dist
$(BOX) compile
touch $@
Expand Down
73 changes: 36 additions & 37 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions fixtures/set028-symfony/.env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file is a "template" of which env vars need to be defined for your application
# Copy this file to .env file for development, create environment variables when deploying to production
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=7379902cbd219672e341bc2d985138b1
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
###< symfony/framework-bundle ###
7 changes: 7 additions & 0 deletions fixtures/set028-symfony/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

###> symfony/framework-bundle ###
/.env
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
39 changes: 39 additions & 0 deletions fixtures/set028-symfony/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;

set_time_limit(0);

require __DIR__.'/../vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev', true);
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true);

if ($debug) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($env, $debug);
$application = new Application($kernel);
$application->run($input);
Loading