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

Allow Symfony 4 components #4580

Merged
merged 4 commits into from Nov 23, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 13 additions & 9 deletions .travis.yml
Expand Up @@ -16,6 +16,10 @@ matrix:
env: SYMFONY=3.3.2 SYMFONY_DEPRECATIONS_HELPER=weak # latest version of 3.3.*
- php: 7.2
env: SYMFONY=3.3.2 SYMFONY_DEPRECATIONS_HELPER=weak # latest version of 3.3.*
- php: 7.1
env: SYMFONY_DEPRECATIONS_HELPER=weak # latest version of 4.0.*
- php: 7.2
env: SYMFONY_DEPRECATIONS_HELPER=weak # latest version of 4.0.*

addons:
postgresql: "9.2"
Expand Down Expand Up @@ -68,8 +72,8 @@ install:
- '[[ "$TRAVIS_PHP_VERSION" == "5.4" ]] || [[ "$TRAVIS_PHP_VERSION" == "5.5" ]] || git clone -q -b codeception-2.2 https://github.com/janhenkgerritsen/codeception-lumen-sample.git frameworks-lumen'
- '[[ "$TRAVIS_PHP_VERSION" == "5.4" ]] || [[ "$TRAVIS_PHP_VERSION" == "5.5" ]] || composer update -d frameworks-lumen $composer_parameters'
# Symfony
- '[[ "$SYMFONY" > "3.0.0" ]] || (git clone -q -b 2.1 https://github.com/Codeception/symfony-demo.git frameworks-symfony && echo "Cloned Symfony 2 site")'
- '[[ "$SYMFONY" < "3.0.0" ]] || (git clone -q -b master --recursive https://github.com/Naktibalda/codeception-symfony-tests frameworks-symfony && echo "Cloned Symfony 3 site")'
- '[[ "${SYMFONY:-4.0.0}" > "3.0.0" ]] || (git clone -q -b 2.1 https://github.com/Codeception/symfony-demo.git frameworks-symfony && echo "Cloned Symfony 2 site")'
- '[[ "${SYMFONY:-4.0.0}" < "3.0.0" ]] || (git clone -q -b master --recursive https://github.com/Naktibalda/codeception-symfony-tests frameworks-symfony && echo "Cloned Symfony 3 site")'
- '[[ -z "$SYMFONY" ]] || composer require -d frameworks-symfony symfony/symfony=~$SYMFONY --no-update'
- "mysql -e 'create database symfony_test;'"
- 'composer update -d frameworks-symfony $composer_parameters'
Expand Down Expand Up @@ -102,17 +106,17 @@ before_script:
- '[[ "$TRAVIS_PHP_VERSION" == "5.4" ]] || [[ "$TRAVIS_PHP_VERSION" == "5.5" ]] || touch frameworks-lumen/storage/testing.sqlite'
- '[[ "$TRAVIS_PHP_VERSION" == "5.4" ]] || [[ "$TRAVIS_PHP_VERSION" == "5.5" ]] || php frameworks-lumen/artisan migrate --database=testing --force'
# Symfony
- '[[ "$SYMFONY" > "3.0.0" ]] || php frameworks-symfony/app/console doctrine:schema:create -n --env test'
- '[[ "$SYMFONY" > "3.0.0" ]] || php frameworks-symfony/app/console doctrine:fixtures:load -n --env test'
- '[[ "$SYMFONY" < "3.0.0" ]] || php frameworks-symfony/bin/console doctrine:schema:update --force -n'
- '[[ "${SYMFONY:-4.0.0}" > "3.0.0" ]] || php frameworks-symfony/app/console doctrine:schema:create -n --env test'
- '[[ "${SYMFONY:-4.0.0}" > "3.0.0" ]] || php frameworks-symfony/app/console doctrine:fixtures:load -n --env test'
- '[[ "${SYMFONY:-4.0.0}" < "3.0.0" ]] || php frameworks-symfony/bin/console doctrine:schema:update --force -n'
# ZF2
- "mysql -e 'create database zf2_test;'"
- php frameworks-zf2/vendor/bin/doctrine-module orm:schema-tool:create
# Build
- '[[ "$TRAVIS_PHP_VERSION" == "7.2" ]] || php codecept build -c frameworks-yii-basic'
- '[[ "$TRAVIS_PHP_VERSION" == "5.4" ]] || php codecept build -c frameworks-phalcon'
- '[[ "$SYMFONY" > "3.0.0" ]] || php codecept build -c frameworks-symfony/src/AppBundle'
- '[[ "$SYMFONY" < "3.0.0" ]] || php codecept build -c frameworks-symfony'
- '[[ "${SYMFONY:-4.0.0}" > "3.0.0" ]] || php codecept build -c frameworks-symfony/src/AppBundle'
- '[[ "${SYMFONY:-4.0.0}" < "3.0.0" ]] || php codecept build -c frameworks-symfony'
- '[[ "$TRAVIS_PHP_VERSION" == "5.4" ]] || [[ "$TRAVIS_PHP_VERSION" == "5.5" ]] || php codecept build -c frameworks-l5'
- '[[ "$TRAVIS_PHP_VERSION" == "5.4" ]] || [[ "$TRAVIS_PHP_VERSION" == "5.5" ]] || php codecept build -c frameworks-lumen'
- php codecept build -c frameworks-zf1
Expand All @@ -126,8 +130,8 @@ script:
- '[[ "$TRAVIS_PHP_VERSION" == "5.4" ]] || [[ "$TRAVIS_PHP_VERSION" == "5.5" ]] || php codecept run -c frameworks-l5 --skip=seeder' # Laravel5 Tests
- '[[ "$TRAVIS_PHP_VERSION" == "5.4" ]] || [[ "$TRAVIS_PHP_VERSION" == "5.5" ]] || php codecept run -c frameworks-lumen' # Lumen Tests
- '[[ "$TRAVIS_PHP_VERSION" == "5.4" ]] || php codecept run functional -c frameworks-phalcon' # Phalcon Tests
- '[[ "$SYMFONY" > "3.0.0" ]] || php codecept run functional -c frameworks-symfony/src/AppBundle' # Symfony Tests
- '[[ "$SYMFONY" < "3.0.0" ]] || php codecept run -c frameworks-symfony' # Symfony Tests
- '[[ "${SYMFONY:-4.0.0}" > "3.0.0" ]] || php codecept run functional -c frameworks-symfony/src/AppBundle' # Symfony Tests
- '[[ "${SYMFONY:-4.0.0}" < "3.0.0" ]] || php codecept run -c frameworks-symfony' # Symfony Tests
- php codecept run functional -c frameworks-zf1 # ZF1 Tests
#ZF2 run doctrine tests on PHP 5.4 and 5.5 only
- '[[ "$TRAVIS_PHP_VERSION" > "5.5" ]] || php codecept run -c frameworks-zf2 functional,doctrine'
Expand Down
8 changes: 7 additions & 1 deletion codecept
Expand Up @@ -30,7 +30,13 @@ $app->add(new Codeception\Command\GherkinSnippets('gherkin:snippets'));
$app->add(new Codeception\Command\GherkinSteps('gherkin:steps'));
$app->add(new Codeception\Command\DryRun('dry-run'));
$app->add(new Codeception\Command\ConfigValidate('config:validate'));
$app->add(new Codeception\Command\Completion());

// Suggests package
if (class_exists('Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand')) {
$app->add(new Codeception\Command\Completion());
} else {
$app->add(new Codeception\Command\CompletionFallback());
}

$app->registerCustomCommands();
$app->run();
24 changes: 12 additions & 12 deletions composer.json
Expand Up @@ -12,7 +12,7 @@
"homepage":"http://codegyre.com"
}
],
"minimum-stability": "stable",
"minimum-stability": "RC",

"require": {
"php": ">=5.4.0 <8.0",
Expand All @@ -24,17 +24,16 @@
"facebook/webdriver": ">=1.1.3 <2.0",
"guzzlehttp/guzzle": ">=4.1.4 <7.0",
"guzzlehttp/psr7": "~1.0",
"symfony/finder": ">=2.7 <4.0",
"symfony/console": ">=2.7 <4.0",
"symfony/event-dispatcher": ">=2.7 <4.0",
"symfony/yaml": ">=2.7 <4.0",
"symfony/browser-kit": ">=2.7 <4.0",
"symfony/css-selector": ">=2.7 <4.0",
"symfony/dom-crawler": ">=2.7.5 <4.0",
"symfony/finder": ">=2.7 <5.0",
"symfony/console": ">=2.7 <5.0",
"symfony/event-dispatcher": ">=2.7 <5.0",
"symfony/yaml": ">=2.7 <5.0",
"symfony/browser-kit": ">=2.7 <5.0",
"symfony/css-selector": ">=2.7 <5.0",
"symfony/dom-crawler": ">=2.7 <5.0",
"behat/gherkin": "~4.4.0",
"sebastian/comparator": ">1.1 <3.0",
"sebastian/diff": ">=1.4 <3.0",
"stecman/symfony-console-completion": "^0.7.0"
"sebastian/diff": ">=1.4 <3.0"
},
"require-dev": {
"monolog/monolog": "~1.8",
Expand All @@ -48,7 +47,7 @@
"predis/predis": "^1.0",
"squizlabs/php_codesniffer": "~2.0",
"vlucas/phpdotenv": "^2.4.0",
"symfony/process": ">=2.7 <4.0"
"symfony/process": ">=2.7 <5.0"
},
"suggest": {
"aws/aws-sdk-php": "For using AWS Auth in REST module and Queue module",
Expand All @@ -58,7 +57,8 @@
"phpseclib/phpseclib": "for SFTP option in FTP Module",
"league/factory-muffin": "For DataFactory module",
"league/factory-muffin-faker": "For Faker support in DataFactory module",
"symfony/phpunit-bridge": "For phpunit-bridge support"
"symfony/phpunit-bridge": "For phpunit-bridge support",
"stecman/symfony-console-completion": "For BASH autocompletion"
},

"autoload":{
Expand Down
40 changes: 40 additions & 0 deletions src/Codeception/Command/CompletionFallback.php
@@ -0,0 +1,40 @@
<?php
namespace Codeception\Command;

use Codeception\Configuration;
use Stecman\Component\Symfony\Console\BashCompletion\Completion as ConsoleCompletion;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionHandler;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\ShellPathCompletion as ShellPathCompletion;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class CompletionFallback extends Command
{
protected function configure()
{
$this
->setName('_completion')
->setDescription('BASH completion hook.')
->setHelp(<<<END
To enable BASH completion, install optional stecman/symfony-console-completion first:

<comment>composer require stecman/symfony-console-completion</comment>

END
);

// Hide this command from listing if supported
// Command::setHidden() was not available before Symfony 3.2.0
if (method_exists($this, 'setHidden')) {
$this->setHidden(true);
}
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln("Install optional <comment>stecman/symfony-console-completion</comment>");
}
}
16 changes: 5 additions & 11 deletions tests/cli/DataProviderFailuresAndExceptionsCest.php
Expand Up @@ -43,7 +43,6 @@ public function runTestWithDataProvidersFailureStdout(\CliGuy $I)
public function runTestWithDataProvidersFailureStderr(\CliGuy $I)
{
$I->executeCommand('run -n unit DataProvidersFailureCest 2>&1',false);
$I->seeInShellOutput('[Codeception\Exception\TestParseException]');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove some assertions from this test?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format of output in Symfony Console has changed

$I->seeInShellOutput('Couldn\'t parse test');
$I->seeInShellOutput('DataProvider \'rectangle\' for DataProvidersFailureCest->testIsTriangle');
$I->seeInShellOutput('Make sure that the dataprovider exist within the test class.');
Expand All @@ -57,7 +56,6 @@ public function runTestWithDataProvidersFailureStderr(\CliGuy $I)
$I->dontSeeInShellOutput('Tests: 1, Assertions: 0, Warnings: 1.');
// In normal mode the Exception trace should not appear.
$I->dontSeeInShellOutput('Exception trace');
$I->dontSeeInShellOutput('Test'.DIRECTORY_SEPARATOR.'Loader'.DIRECTORY_SEPARATOR.'Cest.php:');
$I->seeResultCodeIs(1);
}

Expand All @@ -71,7 +69,6 @@ public function runTestWithDataProvidersFailureStderr(\CliGuy $I)
public function runTestWithDataProvidersFailureStderrVerbose(\CliGuy $I)
{
$I->executeCommand('run -n unit DataProvidersFailureCest -v 2>&1',false);
$I->seeInShellOutput('[Codeception\Exception\TestParseException]');
$I->seeInShellOutput('Couldn\'t parse test');
$I->seeInShellOutput('DataProvider \'rectangle\' for DataProvidersFailureCest->testIsTriangle');
$I->seeInShellOutput('Make sure that the dataprovider exist within the test class.');
Expand All @@ -84,8 +81,8 @@ public function runTestWithDataProvidersFailureStderrVerbose(\CliGuy $I)
$I->dontSeeInShellOutput('OK');
$I->dontSeeInShellOutput('Tests: 1, Assertions: 0, Warnings: 1.');
// In verbose mode the Exception trace should be output.
$I->seeInShellOutput('[Codeception\Exception\TestParseException]');
$I->seeInShellOutput('Exception trace');
$I->seeInShellOutput('Test'.DIRECTORY_SEPARATOR.'Loader'.DIRECTORY_SEPARATOR.'Cest.php:');
$I->seeResultCodeIs(1);

}
Expand Down Expand Up @@ -134,12 +131,10 @@ public function runTestWithDataProvidersExceptionStderr(\CliGuy $I)
$I->dontSeeInShellOutput('Couldn\'t parse test');
$I->dontSeeInShellOutput('DataProvider \'rectangle\' for DataProvidersFailureCest->testIsTriangle ');

// We should just see the exception and the message
$I->seeInShellOutput('[Exception]');
// We should just see the message
$I->seeInShellOutput('Something went wrong!!!');
// We don't have the verbose flag set, so there should be no trace.
$I->dontSeeInShellOutput('Exception trace:');
$I->dontSeeInShellOutput('DataProvidersExceptionCest');
$I->seeResultCodeIs(1);

}
Expand All @@ -165,12 +160,11 @@ public function runTestWithDataProvidersExceptionStderrVerbose(\CliGuy $I)
$I->dontSeeInShellOutput('Couldn\'t parse test');
$I->dontSeeInShellOutput('DataProvider \'rectangle\' for DataProvidersFailureCest->testIsTriangle is ');

// We should just see the exception and the message
$I->seeInShellOutput('[Exception]');
// We should just see the message
$I->seeInShellOutput('Something went wrong!!!');
// We have the verbose flag set, so there should be a trace.
$I->seeInShellOutput('[Exception]');
$I->seeInShellOutput('Exception trace:');
$I->seeInShellOutput('DataProvidersExceptionCest');
$I->seeResultCodeIs(1);
}
}
}