From f11bfe981c0a945a9b541ef177a72429adf129db Mon Sep 17 00:00:00 2001 From: Zaahid Bateson Date: Mon, 8 Jun 2015 00:37:14 -0700 Subject: [PATCH] Code cleanup (PSR-2) and some refactoring - Basic syntax checking and cleanup - Changed code for a little more consistency --- src/Codeception/Actor.php | 6 +- src/Codeception/Codecept.php | 11 ++- src/Codeception/Command/Bootstrap.php | 6 +- src/Codeception/Command/Build.php | 85 ++++++++++++------- src/Codeception/Command/Clean.php | 9 +- src/Codeception/Command/Console.php | 27 +++--- src/Codeception/Command/GenerateCept.php | 15 ++-- src/Codeception/Command/GenerateCest.php | 12 ++- .../Command/GenerateEnvironment.php | 17 ++-- src/Codeception/Command/GenerateGroup.php | 11 +-- src/Codeception/Command/GenerateHelper.php | 10 +-- .../Command/GeneratePageObject.php | 14 ++- src/Codeception/Command/GeneratePhpUnit.php | 16 ++-- src/Codeception/Command/GenerateScenarios.php | 18 ++-- .../Command/GenerateStepObject.php | 14 ++- src/Codeception/Command/GenerateSuite.php | 15 ++-- src/Codeception/Command/GenerateTest.php | 3 +- src/Codeception/Command/Run.php | 63 +++++++------- src/Codeception/Command/SelfUpdate.php | 5 +- src/Codeception/Command/Shared/Config.php | 3 +- src/Codeception/Command/Shared/FileSystem.php | 2 +- src/Codeception/Command/Shared/Style.php | 4 +- src/Codeception/Configuration.php | 1 - src/Codeception/Coverage/Filter.php | 2 - src/Codeception/Coverage/Subscriber/Local.php | 1 - .../Coverage/Subscriber/LocalServer.php | 11 +-- .../Coverage/Subscriber/Printer.php | 9 +- .../Coverage/Subscriber/RemoteServer.php | 2 - src/Codeception/Coverage/SuiteSubscriber.php | 4 +- src/Codeception/Event/FailEvent.php | 1 - src/Codeception/Event/PrintResultEvent.php | 1 - src/Codeception/Event/SuiteEvent.php | 1 - src/Codeception/Events.php | 1 - .../Exception/ConditionalAssertionFailed.php | 1 - .../Exception/ConfigurationException.php | 1 - .../Exception/ConnectionException.php | 2 +- src/Codeception/Exception/ContentNotFound.php | 3 +- src/Codeception/Exception/ElementNotFound.php | 2 - .../Exception/MalformedLocatorException.php | 2 +- .../Exception/ModuleConfigException.php | 1 - .../Exception/ModuleConflictException.php | 8 +- src/Codeception/Exception/ModuleException.php | 2 - .../Exception/ModuleRequireException.php | 2 - src/Codeception/Exception/RemoteException.php | 1 - src/Codeception/Extension.php | 4 +- src/Codeception/GroupObject.php | 1 - src/Codeception/Lib/Actor/Shared/Friend.php | 8 +- src/Codeception/Lib/Connector/Guzzle.php | 5 +- src/Codeception/Lib/Connector/Laravel4.php | 3 +- src/Codeception/Lib/Connector/Laravel5.php | 3 +- src/Codeception/Lib/Connector/Lumen.php | 3 +- src/Codeception/Lib/Connector/Phalcon1.php | 1 - .../Shared/PhpSuperGlobalsConverter.php | 3 - src/Codeception/Lib/Connector/Symfony2.php | 4 +- src/Codeception/Lib/Connector/Yii1.php | 1 - src/Codeception/Lib/Connector/Yii2.php | 3 +- src/Codeception/Lib/Connector/ZF2.php | 1 - src/Codeception/Lib/Console/Message.php | 1 - src/Codeception/Lib/Driver/AmazonSQS.php | 9 +- src/Codeception/Lib/Driver/Beanstalk.php | 2 +- src/Codeception/Lib/Driver/Db.php | 34 +++----- src/Codeception/Lib/Driver/Facebook.php | 1 - src/Codeception/Lib/Driver/Iron.php | 19 ++--- src/Codeception/Lib/Driver/MongoDb.php | 3 +- src/Codeception/Lib/Driver/MsSql.php | 12 +-- src/Codeception/Lib/Driver/MySql.php | 4 +- src/Codeception/Lib/Driver/Oci.php | 4 +- src/Codeception/Lib/Driver/PostgreSql.php | 19 +++-- src/Codeception/Lib/Driver/Redis.php | 2 +- src/Codeception/Lib/Driver/Sqlite.php | 5 +- src/Codeception/Lib/Driver/SqliteGeneral.php | 5 +- src/Codeception/Lib/Friend.php | 1 - src/Codeception/Lib/Generator/Actions.php | 5 +- src/Codeception/Lib/Generator/Actor.php | 2 - src/Codeception/Lib/Generator/Cept.php | 1 - src/Codeception/Lib/Generator/Cest.php | 2 +- src/Codeception/Lib/Generator/Group.php | 3 +- src/Codeception/Lib/Generator/Helper.php | 3 +- src/Codeception/Lib/Generator/PageObject.php | 2 +- src/Codeception/Lib/Generator/PhpUnit.php | 3 +- .../Lib/Generator/Shared/Classname.php | 2 +- src/Codeception/Lib/Generator/StepObject.php | 1 - src/Codeception/Lib/Generator/Test.php | 2 - .../Lib/Interfaces/ActiveRecord.php | 3 +- .../Lib/Interfaces/ConflictsWithModule.php | 2 +- src/Codeception/Lib/Interfaces/Db.php | 1 - .../Lib/Interfaces/DependsOnModule.php | 2 +- .../Lib/Interfaces/DoctrineProvider.php | 2 +- .../Lib/Interfaces/MultiSession.php | 1 - .../Lib/Interfaces/PageSourceSaver.php | 2 +- .../Lib/Interfaces/PartedModule.php | 2 +- src/Codeception/Lib/Interfaces/Queue.php | 6 +- src/Codeception/Lib/Interfaces/Remote.php | 1 - .../Lib/Interfaces/ScreenshotSaver.php | 2 +- src/Codeception/Lib/Interfaces/Web.php | 1 - src/Codeception/Lib/ModuleContainer.php | 8 +- src/Codeception/Lib/Parser.php | 7 +- src/Codeception/Lib/Suite.php | 4 +- src/Codeception/Lib/TestLoader.php | 5 +- src/Codeception/Module.php | 5 +- src/Codeception/Module/AMQP.php | 14 +-- src/Codeception/Module/Asserts.php | 7 +- src/Codeception/Module/Cli.php | 5 +- src/Codeception/Module/Db.php | 36 ++++---- src/Codeception/Module/Dbh.php | 38 +++++---- src/Codeception/Module/Doctrine2.php | 39 +++++---- src/Codeception/Module/FTP.php | 7 +- src/Codeception/Module/Facebook.php | 1 - src/Codeception/Module/Filesystem.php | 11 +-- src/Codeception/Module/Laravel4.php | 33 ++++--- src/Codeception/Module/Laravel5.php | 25 +++--- src/Codeception/Module/Lumen.php | 18 ++-- src/Codeception/Module/Memcache.php | 14 +-- src/Codeception/Module/MongoDb.php | 61 +++++++++---- src/Codeception/Module/Phalcon1.php | 31 +++---- src/Codeception/Module/PhpBrowser.php | 21 ++++- src/Codeception/Module/Queue.php | 13 +-- src/Codeception/Module/REST.php | 12 ++- src/Codeception/Module/Redis.php | 10 +-- src/Codeception/Module/SOAP.php | 47 +++++----- src/Codeception/Module/Sequence.php | 6 +- src/Codeception/Module/Silex.php | 4 +- src/Codeception/Module/Symfony2.php | 13 ++- src/Codeception/Module/WebDriver.php | 27 +++--- src/Codeception/Module/XMLRPC.php | 25 ++++-- src/Codeception/Module/Yii1.php | 26 +++--- src/Codeception/Module/Yii2.php | 43 +++++++--- src/Codeception/Module/ZF1.php | 25 +++--- src/Codeception/Module/ZF2.php | 21 +++-- src/Codeception/PHPUnit/ConsolePrinter.php | 2 +- .../PHPUnit/Constraint/Crawler.php | 16 ++-- .../PHPUnit/Constraint/CrawlerNot.php | 8 +- src/Codeception/PHPUnit/Constraint/Page.php | 1 - .../PHPUnit/Constraint/WebDriver.php | 9 +- .../PHPUnit/Constraint/WebDriverNot.php | 6 +- src/Codeception/PHPUnit/Listener.php | 1 - src/Codeception/PHPUnit/Log/JUnit.php | 1 - .../PHPUnit/ResultPrinter/HTML.php | 8 +- .../PHPUnit/ResultPrinter/Report.php | 21 ++--- src/Codeception/PHPUnit/ResultPrinter/UI.php | 1 - src/Codeception/PHPUnit/Runner.php | 4 +- src/Codeception/Platform/Extension.php | 6 +- src/Codeception/Platform/Group.php | 2 +- src/Codeception/Step/Action.php | 4 +- src/Codeception/Step/Assertion.php | 4 +- src/Codeception/Step/Comment.php | 6 +- src/Codeception/Step/Condition.php | 4 +- src/Codeception/Step/ConditionalAssertion.php | 4 +- src/Codeception/Step/Executor.php | 3 +- src/Codeception/Step/Incomplete.php | 4 +- src/Codeception/Step/Meta.php | 9 +- src/Codeception/Step/Skip.php | 4 +- src/Codeception/Subscriber/AutoRebuild.php | 6 +- src/Codeception/Subscriber/Bootstrap.php | 4 +- src/Codeception/Subscriber/Console.php | 40 +++++---- src/Codeception/Subscriber/ErrorHandler.php | 2 - src/Codeception/Subscriber/FailFast.php | 3 +- .../Subscriber/GracefulTermination.php | 10 ++- src/Codeception/Subscriber/Module.php | 1 - .../Subscriber/Shared/StaticEvents.php | 2 - src/Codeception/TestCase/Cept.php | 35 +++++--- src/Codeception/TestCase/Cest.php | 28 +++--- .../TestCase/Interfaces/Configurable.php | 2 - src/Codeception/TestCase/Interfaces/Plain.php | 2 +- .../TestCase/Interfaces/Reported.php | 4 +- .../TestCase/Interfaces/ScenarioDriven.php | 3 +- src/Codeception/TestCase/Shared/Actor.php | 6 +- .../TestCase/Shared/Configuration.php | 7 +- .../TestCase/Shared/Dependencies.php | 20 +++-- .../TestCase/Shared/ScenarioPrint.php | 3 +- src/Codeception/TestCase/Test.php | 20 +++-- src/Codeception/Util/Annotation.php | 1 - src/Codeception/Util/Autoload.php | 1 - src/Codeception/Util/Debug.php | 1 - src/Codeception/Util/FileSystem.php | 1 - src/Codeception/Util/Fixtures.php | 1 - src/Codeception/Util/JsonArray.php | 2 +- src/Codeception/Util/Locator.php | 1 - src/Codeception/Util/Maybe.php | 8 +- src/Codeception/Util/Shared/Asserts.php | 2 - src/Codeception/Util/Shared/Namespaces.php | 3 +- src/Codeception/Util/Soap.php | 2 - src/Codeception/Util/Stub.php | 19 ++--- src/Codeception/Util/Template.php | 4 +- src/Codeception/Util/Xml.php | 2 +- src/Codeception/Util/XmlStructure.php | 4 +- 186 files changed, 860 insertions(+), 817 deletions(-) diff --git a/src/Codeception/Actor.php b/src/Codeception/Actor.php index 5376e466b2..e16f8dde00 100644 --- a/src/Codeception/Actor.php +++ b/src/Codeception/Actor.php @@ -3,6 +3,8 @@ use Codeception\Lib\Actor\Shared\Comment; use Codeception\Lib\Actor\Shared\Friend; +use Codeception\Scenario; +use Codeception\Step\Executor; abstract class Actor { @@ -14,7 +16,7 @@ abstract class Actor */ protected $scenario; - public function __construct(\Codeception\Scenario $scenario) + public function __construct(Scenario $scenario) { $this->scenario = $scenario; $this->scenario->stopIfBlocked(); @@ -51,7 +53,7 @@ public function __call($method, $arguments) */ public function execute($callable) { - $this->scenario->addStep(new \Codeception\Step\Executor($callable, [])); + $this->scenario->addStep(new Executor($callable, [])); $callable(); return $this; } diff --git a/src/Codeception/Codecept.php b/src/Codeception/Codecept.php index bd54d950d7..d109e0d4eb 100644 --- a/src/Codeception/Codecept.php +++ b/src/Codeception/Codecept.php @@ -1,7 +1,7 @@ extensions[] = $extension; } diff --git a/src/Codeception/Command/Bootstrap.php b/src/Codeception/Command/Bootstrap.php index b948df3a92..1f94cb97b3 100644 --- a/src/Codeception/Command/Bootstrap.php +++ b/src/Codeception/Command/Bootstrap.php @@ -1,5 +1,4 @@ dataDir); @mkdir($this->supportDir); @mkdir($this->envsDir); - file_put_contents($this->dataDir . '/dump.sql', '/* Replace this file with actual dump of your database */'); + file_put_contents( + $this->dataDir . '/dump.sql', + '/* Replace this file with actual dump of your database */' + ); } } diff --git a/src/Codeception/Command/Build.php b/src/Codeception/Command/Build.php index 0adb828fee..0850d66913 100644 --- a/src/Codeception/Command/Build.php +++ b/src/Codeception/Command/Build.php @@ -36,11 +36,9 @@ public function getDescription() protected function configure() { - $this->setDefinition( - [ - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - ] - ); + $this->setDefinition([ + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + ]); } protected function execute(InputInterface $input, OutputInterface $output) @@ -48,43 +46,68 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->output = $output; $this->buildActorsForConfig($input->getOption('config')); } - - protected function buildActorsForConfig($configFile) + + private function buildActor(array $settings) { - $config = $this->getGlobalConfig($configFile); - $suites = $this->getSuites($configFile); - - $path = pathinfo($configFile); - $dir = isset($path['dirname']) ? $path['dirname'] : getcwd(); + $actorGenerator = new ActorGenerator($settings); + $this->output->writeln( + '' . Configuration::config()['namespace'] . '\\' . $actorGenerator->getActorName() + . " includes modules: " . implode(', ', $actorGenerator->getModules()) + ); + + $content = $actorGenerator->produce(); - foreach ($config['include'] as $subConfig) { - $this->output->writeln("Included Configuration: $subConfig"); - $this->buildActorsForConfig($dir . DIRECTORY_SEPARATOR . $subConfig); - } + $file = $this->buildPath( + Configuration::supportDir(), + $settings['class_name']) . $this->getClassName($settings['class_name'] + ); + $file .= '.php'; + return $this->save($file, $content); + } + + private function buildActions(array $settings) + { + $actionsGenerator = new ActionsGenerator($settings); + $this->output->writeln( + " -> {$settings['class_name']}Actions.php generated successfully. " + . $actionsGenerator->getNumMethods() . " methods added" + ); + + $content = $actionsGenerator->produce(); + + $file = $this->buildPath(Configuration::supportDir() . '_generated', $settings['class_name']); + $file .= $this->getClassName($settings['class_name']) . 'Actions.php'; + return $this->save($file, $content, true); + } + private function buildSuiteActors($configFile) + { + $suites = $this->getSuites($configFile); if (!empty($suites)) { $this->output->writeln("Building Actor classes for suites: " . implode(', ', $suites) . ''); } foreach ($suites as $suite) { $settings = $this->getSuiteConfig($suite, $configFile); - $actionsGenerator = new ActionsGenerator($settings); - $contents = $actionsGenerator->produce(); - - $actorGenerator = new ActorGenerator($settings); - $file = $this->buildPath(Configuration::supportDir() . '_generated', $settings['class_name']) . $this->getClassName($settings['class_name']) . 'Actions.php'; - $this->save($file, $contents, true); - - $this->output->writeln('' . Configuration::config()['namespace'] . '\\' . $actorGenerator->getActorName() . " includes modules: " . implode(', ', $actorGenerator->getModules())); - $this->output->writeln(" -> {$settings['class_name']}Actions.php generated successfully. " . $actionsGenerator->getNumMethods() . " methods added"); - - $contents = $actorGenerator->produce(); - - $file = $this->buildPath(Configuration::supportDir(), $settings['class_name']) . $this->getClassName($settings['class_name']) . '.php'; - if ($this->save($file, $contents)) { + $actorBuilt = $this->buildActor($settings); + $this->buildActions($settings); + + if ($actorBuilt) { $this->output->writeln("{$settings['class_name']}.php created."); } - } } + + protected function buildActorsForConfig($configFile) + { + $config = $this->getGlobalConfig($configFile); + + $path = pathinfo($configFile); + $dir = isset($path['dirname']) ? $path['dirname'] : getcwd(); + foreach ($config['include'] as $subConfig) { + $this->output->writeln("Included Configuration: $subConfig"); + $this->buildActorsForConfig($dir . DIRECTORY_SEPARATOR . $subConfig); + } + $this->buildSuiteActors($configFile); + } } diff --git a/src/Codeception/Command/Clean.php b/src/Codeception/Command/Clean.php index 31335ab262..75a025e1a2 100644 --- a/src/Codeception/Command/Clean.php +++ b/src/Codeception/Command/Clean.php @@ -1,7 +1,6 @@ setDefinition( - [ - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - ] - ); + $this->setDefinition([ + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + ]); parent::configure(); } diff --git a/src/Codeception/Command/Console.php b/src/Codeception/Command/Console.php index 0745c4128b..35d675c652 100644 --- a/src/Codeception/Command/Console.php +++ b/src/Codeception/Command/Console.php @@ -1,5 +1,4 @@ setDefinition( - [ - new InputArgument('suite', InputArgument::REQUIRED, 'suite to be executed'), - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - new InputOption('colors', '', InputOption::VALUE_NONE, 'Use colors in output'), - ] - ); + $this->setDefinition([ + new InputArgument('suite', InputArgument::REQUIRED, 'suite to be executed'), + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + new InputOption('colors', '', InputOption::VALUE_NONE, 'Use colors in output'), + ]); parent::configure(); } @@ -87,9 +82,11 @@ public function execute(InputInterface $input, OutputInterface $output) ->initConfig(); $scenario = new Scenario($this->test); - if (isset($config["namespace"])) $settings['class_name'] = $config["namespace"] .'\\' . $settings['class_name']; - $actor = $settings['class_name']; - $I = new $actor($scenario); + if (isset($config["namespace"])) { + $settings['class_name'] = $config["namespace"] .'\\' . $settings['class_name']; + } + $actor = $settings['class_name']; + $I = new $actor($scenario); $this->listenToSignals(); @@ -130,7 +127,7 @@ protected function executeCommands(InputInterface $input, OutputInterface $outpu if ($command == 'actions') { $output->writeln("" . implode(' ', $this->actions)); continue; - }; + } if ($command == 'exit') { return; } @@ -139,7 +136,7 @@ protected function executeCommands(InputInterface $input, OutputInterface $outpu } try { $value = eval("return \$I->$command;"); - if ($value and !is_object($value)) { + if ($value && !is_object($value)) { codecept_debug($value); } } catch (\PHPUnit_Framework_AssertionFailedError $fail) { diff --git a/src/Codeception/Command/GenerateCept.php b/src/Codeception/Command/GenerateCept.php index 0649964977..8816b73479 100644 --- a/src/Codeception/Command/GenerateCept.php +++ b/src/Codeception/Command/GenerateCept.php @@ -23,13 +23,11 @@ class GenerateCept extends Command protected function configure() { - $this->setDefinition( - [ - new InputArgument('suite', InputArgument::REQUIRED, 'suite to be tested'), - new InputArgument('test', InputArgument::REQUIRED, 'test to be run'), - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - ] - ); + $this->setDefinition([ + new InputArgument('suite', InputArgument::REQUIRED, 'suite to be tested'), + new InputArgument('test', InputArgument::REQUIRED, 'test to be run'), + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + ]); } public function getDescription() @@ -56,5 +54,4 @@ public function execute(InputInterface $input, OutputInterface $output) } $output->writeln("Test was created in $full_path"); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Command/GenerateCest.php b/src/Codeception/Command/GenerateCest.php index 60fc5c3d82..08f51f9130 100644 --- a/src/Codeception/Command/GenerateCest.php +++ b/src/Codeception/Command/GenerateCest.php @@ -24,13 +24,11 @@ class GenerateCest extends Command protected function configure() { - $this->setDefinition( - [ - new InputArgument('suite', InputArgument::REQUIRED, 'suite where tests will be put'), - new InputArgument('class', InputArgument::REQUIRED, 'test name'), - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - ] - ); + $this->setDefinition([ + new InputArgument('suite', InputArgument::REQUIRED, 'suite where tests will be put'), + new InputArgument('class', InputArgument::REQUIRED, 'test name'), + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + ]); } public function getDescription() diff --git a/src/Codeception/Command/GenerateEnvironment.php b/src/Codeception/Command/GenerateEnvironment.php index 65abbe82f6..c3ba984931 100644 --- a/src/Codeception/Command/GenerateEnvironment.php +++ b/src/Codeception/Command/GenerateEnvironment.php @@ -23,12 +23,10 @@ class GenerateEnvironment extends Command protected function configure() { - $this->setDefinition( - [ - new InputArgument('env', InputArgument::REQUIRED, 'Environment name'), - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - ] - ); + $this->setDefinition([ + new InputArgument('env', InputArgument::REQUIRED, 'Environment name'), + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + ]); } public function getDescription() @@ -40,9 +38,10 @@ public function execute(InputInterface $input, OutputInterface $output) { $conf = $this->getGlobalConfig($input->getOption('config')); if (!Configuration::envsDir()) { - throw new ConfigurationException("Path for environments configuration is not set.\n". - "Please specify envs path in your `codeception.yml`\n \n". - "envs: tests/_envs" + throw new ConfigurationException( + "Path for environments configuration is not set.\n" + . "Please specify envs path in your `codeception.yml`\n \n" + . "envs: tests/_envs" ); } $relativePath = $conf['paths']['envs']; diff --git a/src/Codeception/Command/GenerateGroup.php b/src/Codeception/Command/GenerateGroup.php index 880f136c48..c20aae2169 100644 --- a/src/Codeception/Command/GenerateGroup.php +++ b/src/Codeception/Command/GenerateGroup.php @@ -21,12 +21,10 @@ class GenerateGroup extends Command protected function configure() { - $this->setDefinition( - [ - new InputArgument('group', InputArgument::REQUIRED, 'Group class name'), - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - ] - ); + $this->setDefinition([ + new InputArgument('group', InputArgument::REQUIRED, 'Group class name'), + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + ]); } public function getDescription() @@ -55,5 +53,4 @@ public function execute(InputInterface $input, OutputInterface $output) $output->writeln("Group extension was created in $filename"); $output->writeln('To use this group extension, include it to "extensions" option of global Codeception config.'); } - } diff --git a/src/Codeception/Command/GenerateHelper.php b/src/Codeception/Command/GenerateHelper.php index fcb79dd9d6..9d303ae37d 100644 --- a/src/Codeception/Command/GenerateHelper.php +++ b/src/Codeception/Command/GenerateHelper.php @@ -22,12 +22,10 @@ class GenerateHelper extends Command protected function configure() { - $this->setDefinition( - [ - new InputArgument('name', InputArgument::REQUIRED, 'suite to be generated'), - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - ] - ); + $this->setDefinition([ + new InputArgument('name', InputArgument::REQUIRED, 'suite to be generated'), + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + ]); } public function getDescription() diff --git a/src/Codeception/Command/GeneratePageObject.php b/src/Codeception/Command/GeneratePageObject.php index 7eb14aeea9..e7331dd164 100644 --- a/src/Codeception/Command/GeneratePageObject.php +++ b/src/Codeception/Command/GeneratePageObject.php @@ -24,14 +24,11 @@ class GeneratePageObject extends Command protected function configure() { - $this->setDefinition( - [ - - new InputArgument('suite', InputArgument::REQUIRED, 'Either suite name or page object name)'), - new InputArgument('page', InputArgument::OPTIONAL, 'Page name of pageobject to represent'), - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - ] - ); + $this->setDefinition([ + new InputArgument('suite', InputArgument::REQUIRED, 'Either suite name or page object name)'), + new InputArgument('page', InputArgument::OPTIONAL, 'Page name of pageobject to represent'), + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + ]); parent::configure(); } @@ -77,5 +74,4 @@ public function execute(InputInterface $input, OutputInterface $output) protected function pathToPageObject($class, $suite) { } - } diff --git a/src/Codeception/Command/GeneratePhpUnit.php b/src/Codeception/Command/GeneratePhpUnit.php index 7ee99290dc..88fea63bd8 100644 --- a/src/Codeception/Command/GeneratePhpUnit.php +++ b/src/Codeception/Command/GeneratePhpUnit.php @@ -1,5 +1,4 @@ setDefinition( - [ - - new InputArgument('suite', InputArgument::REQUIRED, 'suite where tests will be put'), - new InputArgument('class', InputArgument::REQUIRED, 'class name'), - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - ] - ); + $this->setDefinition([ + new InputArgument('suite', InputArgument::REQUIRED, 'suite where tests will be put'), + new InputArgument('class', InputArgument::REQUIRED, 'class name'), + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + ]); parent::configure(); } @@ -63,6 +59,4 @@ public function execute(InputInterface $input, OutputInterface $output) $output->writeln("Test was created in $filename"); } - } - diff --git a/src/Codeception/Command/GenerateScenarios.php b/src/Codeception/Command/GenerateScenarios.php index a86a2eec1c..83fa7c4fdf 100644 --- a/src/Codeception/Command/GenerateScenarios.php +++ b/src/Codeception/Command/GenerateScenarios.php @@ -25,16 +25,14 @@ class GenerateScenarios extends Command protected function configure() { - $this->setDefinition( - [ - new InputArgument('suite', InputArgument::REQUIRED, 'suite from which texts should be generated'), - new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Use specified config instead of default'), - new InputOption('path', 'p', InputOption::VALUE_REQUIRED, 'Use specified path as destination instead of default'), - new InputOption('single-file', '', InputOption::VALUE_NONE, 'Render all scenarios to only one file'), - new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Specify output format: html or text (default)', 'text'), - new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Use specified config instead of default'), - ] - ); + $this->setDefinition([ + new InputArgument('suite', InputArgument::REQUIRED, 'suite from which texts should be generated'), + new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Use specified config instead of default'), + new InputOption('path', 'p', InputOption::VALUE_REQUIRED, 'Use specified path as destination instead of default'), + new InputOption('single-file', '', InputOption::VALUE_NONE, 'Render all scenarios to only one file'), + new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Specify output format: html or text (default)', 'text'), + new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Use specified config instead of default'), + ]); parent::configure(); } diff --git a/src/Codeception/Command/GenerateStepObject.php b/src/Codeception/Command/GenerateStepObject.php index ed945fbad5..4fc5e7647c 100644 --- a/src/Codeception/Command/GenerateStepObject.php +++ b/src/Codeception/Command/GenerateStepObject.php @@ -24,14 +24,12 @@ class GenerateStepObject extends Command protected function configure() { - $this->setDefinition( - [ - new InputArgument('suite', InputArgument::REQUIRED, 'Suite for StepObject'), - new InputArgument('step', InputArgument::REQUIRED, 'StepObject name'), - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - new InputOption('silent', '', InputOption::VALUE_NONE, 'skip verification question'), - ] - ); + $this->setDefinition([ + new InputArgument('suite', InputArgument::REQUIRED, 'Suite for StepObject'), + new InputArgument('step', InputArgument::REQUIRED, 'StepObject name'), + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + new InputOption('silent', '', InputOption::VALUE_NONE, 'skip verification question'), + ]); } public function getDescription() diff --git a/src/Codeception/Command/GenerateSuite.php b/src/Codeception/Command/GenerateSuite.php index cf6b45c935..b53688f8f7 100644 --- a/src/Codeception/Command/GenerateSuite.php +++ b/src/Codeception/Command/GenerateSuite.php @@ -26,13 +26,11 @@ class GenerateSuite extends Command protected function configure() { - $this->setDefinition( - [ - new InputArgument('suite', InputArgument::REQUIRED, 'suite to be generated'), - new InputArgument('actor', InputArgument::OPTIONAL, 'name of new actor class'), - new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), - ] - ); + $this->setDefinition([ + new InputArgument('suite', InputArgument::REQUIRED, 'suite to be generated'), + new InputArgument('actor', InputArgument::OPTIONAL, 'name of new actor class'), + new InputOption('config', 'c', InputOption::VALUE_OPTIONAL, 'Use custom path for config'), + ]); } public function getDescription() @@ -96,5 +94,4 @@ private function containsInvalidCharacters($suite) { return preg_match('#[^A-Za-z0-9_]#', $suite) ? true : false; } - -} \ No newline at end of file +} diff --git a/src/Codeception/Command/GenerateTest.php b/src/Codeception/Command/GenerateTest.php index ade0162870..146b4fefac 100644 --- a/src/Codeception/Command/GenerateTest.php +++ b/src/Codeception/Command/GenerateTest.php @@ -58,6 +58,5 @@ public function execute(InputInterface $input, OutputInterface $output) return; } $output->writeln("Test was created in $filename"); - } -} \ No newline at end of file +} diff --git a/src/Codeception/Command/Run.php b/src/Codeception/Command/Run.php index f7193f92d7..105e3ecfe4 100644 --- a/src/Codeception/Command/Run.php +++ b/src/Codeception/Command/Run.php @@ -1,5 +1,4 @@ setDefinition( - array( - new InputArgument('suite', InputArgument::OPTIONAL, 'suite to be tested'), - new InputArgument('test', InputArgument::OPTIONAL, 'test to be run'), - new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Use custom path for config'), - new InputOption('report', '', InputOption::VALUE_NONE, 'Show output in compact style'), - new InputOption('html', '', InputOption::VALUE_OPTIONAL, 'Generate html with results', 'report.html'), - new InputOption('xml', '', InputOption::VALUE_OPTIONAL, 'Generate JUnit XML Log', 'report.xml'), - new InputOption('tap', '', InputOption::VALUE_OPTIONAL, 'Generate Tap Log', 'report.tap.log'), - new InputOption('json', '', InputOption::VALUE_OPTIONAL, 'Generate Json Log', 'report.json'), - new InputOption('colors', '', InputOption::VALUE_NONE, 'Use colors in output'), - new InputOption('no-colors', '', InputOption::VALUE_NONE, 'Force no colors in output (useful to override config file)'), - new InputOption('silent', '', InputOption::VALUE_NONE, 'Only outputs suite names and final results'), - new InputOption('steps', '', InputOption::VALUE_NONE, 'Show steps in output'), - new InputOption('debug', 'd', InputOption::VALUE_NONE, 'Show debug and scenario output'), - new InputOption('coverage', '', InputOption::VALUE_OPTIONAL, 'Run with code coverage', 'coverage.serialized'), - new InputOption('coverage-html', '', InputOption::VALUE_OPTIONAL, 'Generate CodeCoverage HTML report in path', 'coverage'), - new InputOption('coverage-xml', '', InputOption::VALUE_OPTIONAL, 'Generate CodeCoverage XML report in file', 'coverage.xml'), - new InputOption('coverage-text', '', InputOption::VALUE_OPTIONAL, 'Generate CodeCoverage text report in file', 'coverage.txt'), - new InputOption('no-exit', '', InputOption::VALUE_NONE, 'Don\'t finish with exit code'), - new InputOption('group', 'g', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Groups of tests to be executed'), - new InputOption('skip', 's', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Skip selected suites'), - new InputOption('skip-group', 'sg', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Skip selected groups'), - new InputOption('env', '', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Run tests in selected environments.'), - new InputOption('fail-fast', 'f', InputOption::VALUE_NONE, 'Stop after first failure'), - new InputOption('no-rebuild', '', InputOption::VALUE_NONE, 'Do not rebuild actor classes on start'), - ) - ); + $this->setDefinition([ + new InputArgument('suite', InputArgument::OPTIONAL, 'suite to be tested'), + new InputArgument('test', InputArgument::OPTIONAL, 'test to be run'), + new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'Use custom path for config'), + new InputOption('report', '', InputOption::VALUE_NONE, 'Show output in compact style'), + new InputOption('html', '', InputOption::VALUE_OPTIONAL, 'Generate html with results', 'report.html'), + new InputOption('xml', '', InputOption::VALUE_OPTIONAL, 'Generate JUnit XML Log', 'report.xml'), + new InputOption('tap', '', InputOption::VALUE_OPTIONAL, 'Generate Tap Log', 'report.tap.log'), + new InputOption('json', '', InputOption::VALUE_OPTIONAL, 'Generate Json Log', 'report.json'), + new InputOption('colors', '', InputOption::VALUE_NONE, 'Use colors in output'), + new InputOption('no-colors', '', InputOption::VALUE_NONE, 'Force no colors in output (useful to override config file)'), + new InputOption('silent', '', InputOption::VALUE_NONE, 'Only outputs suite names and final results'), + new InputOption('steps', '', InputOption::VALUE_NONE, 'Show steps in output'), + new InputOption('debug', 'd', InputOption::VALUE_NONE, 'Show debug and scenario output'), + new InputOption('coverage', '', InputOption::VALUE_OPTIONAL, 'Run with code coverage', 'coverage.serialized'), + new InputOption('coverage-html', '', InputOption::VALUE_OPTIONAL, 'Generate CodeCoverage HTML report in path', 'coverage'), + new InputOption('coverage-xml', '', InputOption::VALUE_OPTIONAL, 'Generate CodeCoverage XML report in file', 'coverage.xml'), + new InputOption('coverage-text', '', InputOption::VALUE_OPTIONAL, 'Generate CodeCoverage text report in file', 'coverage.txt'), + new InputOption('no-exit', '', InputOption::VALUE_NONE, 'Don\'t finish with exit code'), + new InputOption('group', 'g', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Groups of tests to be executed'), + new InputOption('skip', 's', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Skip selected suites'), + new InputOption('skip-group', 'sg', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Skip selected groups'), + new InputOption('env', '', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Run tests in selected environments.'), + new InputOption('fail-fast', 'f', InputOption::VALUE_NONE, 'Stop after first failure'), + new InputOption('no-rebuild', '', InputOption::VALUE_NONE, 'Do not rebuild actor classes on start'), + ]); parent::configure(); } @@ -329,10 +326,10 @@ private function ensureCurlIsAvailable() { if (!extension_loaded('curl')) { throw new \Exception( - "Codeception requires CURL extension installed to make tests run\n" . - "If you are not sure, how to install CURL, please refer to StackOverflow\n\n" . - "Notice: PHP for Apache/Nginx and CLI can have different php.ini files.\n" . - "Please make sure that your PHP you run from console has CURL enabled." + "Codeception requires CURL extension installed to make tests run\n" + . "If you are not sure, how to install CURL, please refer to StackOverflow\n\n" + . "Notice: PHP for Apache/Nginx and CLI can have different php.ini files.\n" + . "Please make sure that your PHP you run from console has CURL enabled." ); } } diff --git a/src/Codeception/Command/SelfUpdate.php b/src/Codeception/Command/SelfUpdate.php index d1120d2cc3..1086489c07 100644 --- a/src/Codeception/Command/SelfUpdate.php +++ b/src/Codeception/Command/SelfUpdate.php @@ -104,7 +104,7 @@ public function execute(InputInterface $input, OutputInterface $output) } /** - * Checks wether the provided version is current. + * Checks whether the provided version is current. * * @param string $version The version number to check. * @return boolean Returns True if a new version is available. @@ -114,7 +114,8 @@ private function isOutOfDate($version) $tags = $this->getGithubTags(self::GITHUB); $this->liveVersion = array_reduce( - $tags, function ($a, $b) { + $tags, + function ($a, $b) { return version_compare($a, $b, '>') ? $a : $b; } ); diff --git a/src/Codeception/Command/Shared/Config.php b/src/Codeception/Command/Shared/Config.php index 4df287e461..d988261cc0 100644 --- a/src/Codeception/Command/Shared/Config.php +++ b/src/Codeception/Command/Shared/Config.php @@ -21,5 +21,4 @@ protected function getSuites($conf) Configuration::config($conf); return Configuration::suites(); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Command/Shared/FileSystem.php b/src/Codeception/Command/Shared/FileSystem.php index 59abb110be..f9a6b95d90 100644 --- a/src/Codeception/Command/Shared/FileSystem.php +++ b/src/Codeception/Command/Shared/FileSystem.php @@ -1,5 +1,6 @@ getFormatter()->setStyle('notice', $style); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Configuration.php b/src/Codeception/Configuration.php index ee3ceb75ca..28c7ad1ee5 100644 --- a/src/Codeception/Configuration.php +++ b/src/Codeception/Configuration.php @@ -541,5 +541,4 @@ protected static function loadSuiteConfig($suite, $path, $settings) $settings = self::mergeConfigs($settings, $suiteConf); return $settings; } - } diff --git a/src/Codeception/Coverage/Filter.php b/src/Codeception/Coverage/Filter.php index b45df7a680..963a82848b 100644 --- a/src/Codeception/Coverage/Filter.php +++ b/src/Codeception/Coverage/Filter.php @@ -1,5 +1,4 @@ filter; } - } diff --git a/src/Codeception/Coverage/Subscriber/Local.php b/src/Codeception/Coverage/Subscriber/Local.php index cfb521feb6..a411e127f7 100644 --- a/src/Codeception/Coverage/Subscriber/Local.php +++ b/src/Codeception/Coverage/Subscriber/Local.php @@ -44,5 +44,4 @@ public function afterSuite(SuiteEvent $e) } $this->mergeToPrint($e->getResult()->getCodeCoverage()); } - } diff --git a/src/Codeception/Coverage/Subscriber/LocalServer.php b/src/Codeception/Coverage/Subscriber/LocalServer.php index 165311c65a..523f22a3b8 100644 --- a/src/Codeception/Coverage/Subscriber/LocalServer.php +++ b/src/Codeception/Coverage/Subscriber/LocalServer.php @@ -51,7 +51,7 @@ class LocalServer extends SuiteSubscriber protected function isEnabled() { - return $this->module and !$this->settings['remote'] and $this->settings['enabled']; + return $this->module && !$this->settings['remote'] && $this->settings['enabled']; } public function beforeSuite(SuiteEvent $e) @@ -127,7 +127,8 @@ protected function c3Request($action) $contents = file_get_contents($c3Url . '/c3/report/' . $action, false, $context); $okHeaders = array_filter( - $http_response_header, function ($h) { + $http_response_header, + function ($h) { return preg_match('~^HTTP(.*?)\s200~', $h); } ); @@ -153,7 +154,8 @@ protected function startCoverageCollection($testName) protected function fetchErrors() { - if ($error = $this->module->grabCookie(self::COVERAGE_COOKIE_ERROR)) { + $error = $this->module->grabCookie(self::COVERAGE_COOKIE_ERROR); + if (!empty($error)) { $this->module->resetCookie(self::COVERAGE_COOKIE_ERROR); throw new RemoteException($error); } @@ -183,5 +185,4 @@ protected function applySettings($settings) $this->c3Access = array_replace_recursive($this->c3Access, $settings['coverage']['remote_context_options']); } } - -} \ No newline at end of file +} diff --git a/src/Codeception/Coverage/Subscriber/Printer.php b/src/Codeception/Coverage/Subscriber/Printer.php index 6c9cf52db7..8eff0ac5cf 100644 --- a/src/Codeception/Coverage/Subscriber/Printer.php +++ b/src/Codeception/Coverage/Subscriber/Printer.php @@ -44,7 +44,7 @@ public function __construct($options) protected function absolutePath($path) { - if ((strpos($path, '/') === 0) or (strpos($path, ':') === 1)) { // absolute path + if ((strpos($path, '/') === 0) || (strpos($path, ':') === 1)) { // absolute path return $path; } return $this->logDir . $path; @@ -83,7 +83,10 @@ public function printResult(PrintResultEvent $e) protected function printConsole(\PHPUnit_Util_Printer $printer) { $writer = new \PHP_CodeCoverage_Report_Text( - $this->settings['low_limit'], $this->settings['high_limit'], $this->settings['show_uncovered'], false + $this->settings['low_limit'], + $this->settings['high_limit'], + $this->settings['show_uncovered'], + false ); $printer->write($writer->process(self::$coverage, $this->options['colors'])); } @@ -121,4 +124,4 @@ protected function printText() ); file_put_contents($this->absolutePath($this->options['coverage-text']), $writer->process(self::$coverage, false)); } -} \ No newline at end of file +} diff --git a/src/Codeception/Coverage/Subscriber/RemoteServer.php b/src/Codeception/Coverage/Subscriber/RemoteServer.php index 2f339dc449..95b95955b7 100644 --- a/src/Codeception/Coverage/Subscriber/RemoteServer.php +++ b/src/Codeception/Coverage/Subscriber/RemoteServer.php @@ -2,7 +2,6 @@ namespace Codeception\Coverage\Subscriber; use Codeception\Configuration; -use Codeception\Coverage\Shared\C3Collect; use Codeception\Event\SuiteEvent; use Codeception\Util\FileSystem; @@ -58,5 +57,4 @@ protected function retrieveAndPrintXml($suite) $destFile = Configuration::outputDir() . $suite . '.remote.coverage.xml'; file_put_contents($destFile, $this->c3Request('clover')); } - } diff --git a/src/Codeception/Coverage/SuiteSubscriber.php b/src/Codeception/Coverage/SuiteSubscriber.php index 1fe095057f..682404b7a9 100644 --- a/src/Codeception/Coverage/SuiteSubscriber.php +++ b/src/Codeception/Coverage/SuiteSubscriber.php @@ -9,7 +9,6 @@ abstract class SuiteSubscriber implements EventSubscriberInterface { - use StaticEvents; protected $defaultSettings = [ @@ -86,5 +85,4 @@ protected function mergeToPrint($coverage) { Printer::$coverage->merge($coverage); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Event/FailEvent.php b/src/Codeception/Event/FailEvent.php index 697ca318a8..0098e0d780 100644 --- a/src/Codeception/Event/FailEvent.php +++ b/src/Codeception/Event/FailEvent.php @@ -1,5 +1,4 @@ message = "$module module conflicts with $conflicted\n\n--\n" . - "This usually happens when you enable two modules with the same actions but with different backends.\n" . - "For instance, you can't run PhpBrowser, WebDriver, Laravel4 modules in one suite,\n" . - "as they implement similar methods but use different drivers to execute them."; + $this->message = "$module module conflicts with $conflicted\n\n--\n" + . "This usually happens when you enable two modules with the same actions but with different backends.\n" + . "For instance, you can't run PhpBrowser, WebDriver, Laravel4 modules in one suite,\n" + . "as they implement similar methods but use different drivers to execute them."; } } diff --git a/src/Codeception/Exception/ModuleException.php b/src/Codeception/Exception/ModuleException.php index fe50b99d2f..45435fc303 100644 --- a/src/Codeception/Exception/ModuleException.php +++ b/src/Codeception/Exception/ModuleException.php @@ -3,7 +3,6 @@ class ModuleException extends \Exception { - protected $module; public function __construct($module, $message) @@ -16,5 +15,4 @@ public function __construct($module, $message) parent::__construct($message); $this->message = "$module: {$this->message}"; } - } diff --git a/src/Codeception/Exception/ModuleRequireException.php b/src/Codeception/Exception/ModuleRequireException.php index 906ada5157..18ad17b3e2 100644 --- a/src/Codeception/Exception/ModuleRequireException.php +++ b/src/Codeception/Exception/ModuleRequireException.php @@ -3,7 +3,6 @@ class ModuleRequireException extends \Exception { - public function __construct($module, $message) { if (is_object($module)) { @@ -13,5 +12,4 @@ public function __construct($module, $message) parent::__construct($message); $this->message = $module . " module requirements are not met!\n" . $this->message; } - } diff --git a/src/Codeception/Exception/RemoteException.php b/src/Codeception/Exception/RemoteException.php index 53283b705c..1062d1916e 100644 --- a/src/Codeception/Exception/RemoteException.php +++ b/src/Codeception/Exception/RemoteException.php @@ -1,5 +1,4 @@ friends[$name])) { $actor = $actorClass === null ? $this : new $actorClass($this->getScenario()); - $this->friends[$name] = new \Codeception\Lib\Friend($name, $actor, $this->getScenario()->current('modules')); + $this->friends[$name] = new LibFriend($name, $actor, $this->getScenario()->current('modules')); } return $this->friends[$name]; } - -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Connector/Guzzle.php b/src/Codeception/Lib/Connector/Guzzle.php index e9cae949f6..80cd7632f7 100644 --- a/src/Codeception/Lib/Connector/Guzzle.php +++ b/src/Codeception/Lib/Connector/Guzzle.php @@ -1,5 +1,4 @@ getHeader('Content-Type'); - if (!$contentType or strpos($contentType, 'charset=') === false) { + if (!$contentType || strpos($contentType, 'charset=') === false) { $body = $response->getBody(true); if (preg_match('/\]+charset *= *["\']?([a-zA-Z\-0-9]+)/i', $body, $matches)) { $contentType .= ';charset=' . $matches[1]; @@ -160,7 +159,7 @@ public function getAbsoluteUri($uri) $build[$part] = $value; } } - return \GuzzleHttp\Url::buildUrl($build); + return Url::buildUrl($build); } protected function doRequest($request) diff --git a/src/Codeception/Lib/Connector/Laravel4.php b/src/Codeception/Lib/Connector/Laravel4.php index ba6a4dcdca..b3e8cb0f72 100644 --- a/src/Codeception/Lib/Connector/Laravel4.php +++ b/src/Codeception/Lib/Connector/Laravel4.php @@ -181,5 +181,4 @@ private function getStackedClient() return $method->invoke($this->app); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Connector/Laravel5.php b/src/Codeception/Lib/Connector/Laravel5.php index c91211ed6e..c678a61df0 100644 --- a/src/Codeception/Lib/Connector/Laravel5.php +++ b/src/Codeception/Lib/Connector/Laravel5.php @@ -75,5 +75,4 @@ public function terminate(SyfmonyRequest $request, Response $response) { $this->httpKernel->terminate(Request::createFromBase($request), $response); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Connector/Lumen.php b/src/Codeception/Lib/Connector/Lumen.php index 8d00355a44..9b03fb10f0 100644 --- a/src/Codeception/Lib/Connector/Lumen.php +++ b/src/Codeception/Lib/Connector/Lumen.php @@ -47,5 +47,4 @@ public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $c return $response; } - -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Connector/Phalcon1.php b/src/Codeception/Lib/Connector/Phalcon1.php index c2b4a013b9..7bb942302c 100644 --- a/src/Codeception/Lib/Connector/Phalcon1.php +++ b/src/Codeception/Lib/Connector/Phalcon1.php @@ -1,5 +1,4 @@ kernel->getContainer()->set($serviceName, $service); } } - - -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Connector/Yii1.php b/src/Codeception/Lib/Connector/Yii1.php index 0fee91d538..f54b08c266 100644 --- a/src/Codeception/Lib/Connector/Yii1.php +++ b/src/Codeception/Lib/Connector/Yii1.php @@ -1,5 +1,4 @@ queue = \Aws\Sqs\SqsClient::factory([ - 'credentials' => new \Aws\Common\Credentials\Credentials($config['key'], $config['secret']), + $this->queue = SqsClient::factory([ + 'credentials' => new Credentials($config['key'], $config['secret']), 'region' => $config['region'] ]); if (!$this->queue) { @@ -134,4 +135,4 @@ public function getDefaultConfig() { return []; } -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Driver/Beanstalk.php b/src/Codeception/Lib/Driver/Beanstalk.php index de7dca3f72..f39539cd4b 100644 --- a/src/Codeception/Lib/Driver/Beanstalk.php +++ b/src/Codeception/Lib/Driver/Beanstalk.php @@ -85,4 +85,4 @@ public function getDefaultConfig() { return ['port' => 11300, 'timeout' => 90]; } -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Driver/Db.php b/src/Codeception/Lib/Driver/Db.php index adc845f933..a2ee64d58a 100644 --- a/src/Codeception/Lib/Driver/Db.php +++ b/src/Codeception/Lib/Driver/Db.php @@ -3,7 +3,6 @@ class Db { - /** * @var \PDO */ @@ -136,15 +135,15 @@ public function load($sql) public function insert($tableName, array &$data) { $columns = array_map( - [$this, 'getQuotedName'], - array_keys($data) + [$this, 'getQuotedName'], + array_keys($data) ); return sprintf( - "INSERT INTO %s (%s) VALUES (%s)", - $this->getQuotedName($tableName), - implode(', ', $columns), - implode(', ', array_fill(0, count($data), '?')) + "INSERT INTO %s (%s) VALUES (%s)", + $this->getQuotedName($tableName), + implode(', ', $columns), + implode(', ', array_fill(0, count($data), '?')) ); } @@ -161,9 +160,9 @@ public function select($column, $table, array &$criteria) $params[] = "$k = ?"; } } - $params = implode(' AND ', $params); + $sparams = implode(' AND ', $params); - return sprintf($query, $column, $table, $params); + return sprintf($query, $column, $table, $sparams); } public function deleteQuery($table, $id, $primaryKey = 'id') @@ -184,17 +183,12 @@ public function getQuotedName($name) protected function sqlLine($sql) { - if (trim($sql) == "") { - return true; - } - if (trim($sql) == ";") { - return true; - } - if (preg_match('~^((--.*?)|(#))~s', $sql)) { - return true; - } - - return false; + $sql = trim($sql); + return ( + $sql === '' + || $sql === ';' + || preg_match('~^((--.*?)|(#))~s', $sql) + ); } protected function sqlQuery($query) diff --git a/src/Codeception/Lib/Driver/Facebook.php b/src/Codeception/Lib/Driver/Facebook.php index cfbfa84d2e..bbea666452 100644 --- a/src/Codeception/Lib/Driver/Facebook.php +++ b/src/Codeception/Lib/Driver/Facebook.php @@ -2,7 +2,6 @@ /** * @author tiger */ - namespace Codeception\Lib\Driver; use Facebook\FacebookSession; diff --git a/src/Codeception/Lib/Driver/Iron.php b/src/Codeception/Lib/Driver/Iron.php index 726286409c..18a76947a4 100644 --- a/src/Codeception/Lib/Driver/Iron.php +++ b/src/Codeception/Lib/Driver/Iron.php @@ -5,7 +5,6 @@ class Iron implements Queue { - /** * @var \IronMQ */ @@ -18,14 +17,14 @@ class Iron implements Queue */ public function openConnection($config) { - $this->queue = new \IronMQ( - [ - "token" => $config['token'], - "project_id" => $config['project'], - "host" => $config['host'] - ] - ) OR \PHPUnit_Framework_Assert::fail('connection failed or timed-out.'); - + $this->queue = new \IronMQ([ + "token" => $config['token'], + "project_id" => $config['project'], + "host" => $config['host'] + ]); + if (!$this->queue) { + \PHPUnit_Framework_Assert::fail('connection failed or timed-out.'); + } } /** @@ -104,4 +103,4 @@ public function getDefaultConfig() { return []; } -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Driver/MongoDb.php b/src/Codeception/Lib/Driver/MongoDb.php index 2cd8582961..c97bd611ee 100644 --- a/src/Codeception/Lib/Driver/MongoDb.php +++ b/src/Codeception/Lib/Driver/MongoDb.php @@ -1,5 +1,4 @@ dbh; } -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Driver/MsSql.php b/src/Codeception/Lib/Driver/MsSql.php index 7d6aaad01a..5f17db67e8 100644 --- a/src/Codeception/Lib/Driver/MsSql.php +++ b/src/Codeception/Lib/Driver/MsSql.php @@ -9,12 +9,12 @@ public function cleanup() $this->dbh->exec("OPEN tables_cursor DECLARE @tablename sysname"); $this->dbh->exec( "FETCH NEXT FROM tables_cursor INTO @tablename - WHILE (@@FETCH_STATUS <> -1) - BEGIN - EXEC ('DROP TABLE ' + @tablename) - FETCH NEXT FROM tables_cursor INTO @tablename - END - " + WHILE (@@FETCH_STATUS <> -1) + BEGIN + EXEC ('DROP TABLE ' + @tablename) + FETCH NEXT FROM tables_cursor INTO @tablename + END + " ); $this->dbh->exec('DEALLOCATE tables_cursor'); } diff --git a/src/Codeception/Lib/Driver/MySql.php b/src/Codeception/Lib/Driver/MySql.php index 9221836a4a..5e44d71eac 100644 --- a/src/Codeception/Lib/Driver/MySql.php +++ b/src/Codeception/Lib/Driver/MySql.php @@ -34,9 +34,9 @@ public function select($column, $table, array &$criteria) $params[] = "$k = ?"; } } - $params = implode(' AND ', $params); + $sparams = implode(' AND ', $params); - return sprintf($query, $column, $table, $params); + return sprintf($query, $column, $table, $sparams); } public function getQuotedName($name) diff --git a/src/Codeception/Lib/Driver/Oci.php b/src/Codeception/Lib/Driver/Oci.php index 20bb48e0ce..625bf57781 100644 --- a/src/Codeception/Lib/Driver/Oci.php +++ b/src/Codeception/Lib/Driver/Oci.php @@ -16,9 +16,9 @@ public function select($column, $table, array &$criteria) $params[] = "$k = ? "; } } - $params = implode('AND ', $params); + $sparams = implode('AND ', $params); - return sprintf($query, $column, $table, $params); + return sprintf($query, $column, $table, $sparams); } /** diff --git a/src/Codeception/Lib/Driver/PostgreSql.php b/src/Codeception/Lib/Driver/PostgreSql.php index 24bbf6acf2..06490b67ee 100644 --- a/src/Codeception/Lib/Driver/PostgreSql.php +++ b/src/Codeception/Lib/Driver/PostgreSql.php @@ -1,6 +1,8 @@ dsn, 6)); $constring .= ' user=' . $this->user; @@ -112,9 +114,9 @@ public function select($column, $table, array &$criteria) $params[] = "$k = ? "; } } - $params = implode('AND ', $params); + $sparams = implode('AND ', $params); - return sprintf($query, $column, $table, $params); + return sprintf($query, $column, $table, $sparams); } public function lastInsertId($table) @@ -130,7 +132,8 @@ public function getQuotedName($name) $name = array_map( function ($data) { return '"' . $data . '"'; - }, $name + }, + $name ); return implode('.', $name); } diff --git a/src/Codeception/Lib/Driver/Redis.php b/src/Codeception/Lib/Driver/Redis.php index 42d93242f6..02a1b3cb27 100644 --- a/src/Codeception/Lib/Driver/Redis.php +++ b/src/Codeception/Lib/Driver/Redis.php @@ -988,4 +988,4 @@ function __call($name, $params) array_unshift($params, strtoupper($name)); return $this->cmd($params); } -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Driver/Sqlite.php b/src/Codeception/Lib/Driver/Sqlite.php index c954bf5b50..82afbd4ed2 100644 --- a/src/Codeception/Lib/Driver/Sqlite.php +++ b/src/Codeception/Lib/Driver/Sqlite.php @@ -1,9 +1,10 @@ filename = \Codeception\Configuration::projectDir() . substr($this->dsn, 7); + $this->filename = Configuration::projectDir() . substr($this->dsn, 7); $this->dsn = 'sqlite:' . $this->filename; } diff --git a/src/Codeception/Lib/Driver/SqliteGeneral.php b/src/Codeception/Lib/Driver/SqliteGeneral.php index e6a0793035..bb19018a60 100644 --- a/src/Codeception/Lib/Driver/SqliteGeneral.php +++ b/src/Codeception/Lib/Driver/SqliteGeneral.php @@ -1,9 +1,10 @@ filename = \Codeception\Configuration::projectDir() . substr($this->dsn, 7); + $this->filename = Configuration::projectDir() . substr($this->dsn, 7); $this->dsn = 'sqlite:' . $this->filename; } diff --git a/src/Codeception/Lib/Friend.php b/src/Codeception/Lib/Friend.php index 778034e874..2932d6b8f8 100644 --- a/src/Codeception/Lib/Friend.php +++ b/src/Codeception/Lib/Friend.php @@ -75,6 +75,5 @@ public function __destruct() } } } - } \ No newline at end of file diff --git a/src/Codeception/Lib/Generator/Actions.php b/src/Codeception/Lib/Generator/Actions.php index a9aabda5f3..fddaf8b034 100644 --- a/src/Codeception/Lib/Generator/Actions.php +++ b/src/Codeception/Lib/Generator/Actions.php @@ -29,6 +29,7 @@ abstract protected function getScenario(); {{methods}} } + EOF; @@ -214,6 +215,4 @@ public function getNumMethods() { return $this->numMethods; } - - -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Generator/Actor.php b/src/Codeception/Lib/Generator/Actor.php index eb086cbbd8..2f9d515529 100644 --- a/src/Codeception/Lib/Generator/Actor.php +++ b/src/Codeception/Lib/Generator/Actor.php @@ -25,7 +25,6 @@ class {{actor}} extends \Codeception\Actor /** * Define custom actions here */ - } EOF; @@ -119,5 +118,4 @@ public function getModules() { return array_keys($this->modules); } - } diff --git a/src/Codeception/Lib/Generator/Cept.php b/src/Codeception/Lib/Generator/Cept.php index 008a2ca147..c62de826f8 100644 --- a/src/Codeception/Lib/Generator/Cept.php +++ b/src/Codeception/Lib/Generator/Cept.php @@ -34,5 +34,4 @@ public function produce() ->place('use', $use) ->produce(); } - } diff --git a/src/Codeception/Lib/Generator/Cest.php b/src/Codeception/Lib/Generator/Cest.php index 946372bccb..cd6511ecf3 100644 --- a/src/Codeception/Lib/Generator/Cest.php +++ b/src/Codeception/Lib/Generator/Cest.php @@ -28,6 +28,7 @@ public function tryToTest({{actor}} \$I) { } } + EOF; protected $settings; @@ -52,5 +53,4 @@ public function produce() ->place('actor', $actor) ->produce(); } - } diff --git a/src/Codeception/Lib/Generator/Group.php b/src/Codeception/Lib/Generator/Group.php index d9fbe2e960..28cce7870b 100644 --- a/src/Codeception/Lib/Generator/Group.php +++ b/src/Codeception/Lib/Generator/Group.php @@ -36,6 +36,7 @@ public function _after(TestEvent \$e) { } } + EOF; protected $name; @@ -47,7 +48,6 @@ public function __construct($settings, $name) $this->settings = $settings; $this->name = $name; $this->namespace = $this->getNamespaceString($this->settings['namespace'] . '\\Group\\' . $name); - } public function produce() @@ -60,5 +60,4 @@ public function produce() ->place('groupName', strtolower($this->name)) ->produce(); } - } diff --git a/src/Codeception/Lib/Generator/Helper.php b/src/Codeception/Lib/Generator/Helper.php index 092757b735..a90e04345b 100644 --- a/src/Codeception/Lib/Generator/Helper.php +++ b/src/Codeception/Lib/Generator/Helper.php @@ -40,5 +40,4 @@ public function getHelperName() { return '\\' . $this->namespace . 'Helper\\' . $this->name; } - -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Generator/PageObject.php b/src/Codeception/Lib/Generator/PageObject.php index 8ab349250a..65ab25b801 100644 --- a/src/Codeception/Lib/Generator/PageObject.php +++ b/src/Codeception/Lib/Generator/PageObject.php @@ -36,6 +36,7 @@ public static function route(\$param) {{actions}} } + EOF; protected $actionsTemplate = <<place('pageObject', $this->name) ->produce(); } - } diff --git a/src/Codeception/Lib/Generator/PhpUnit.php b/src/Codeception/Lib/Generator/PhpUnit.php index 35996b3a8f..7018675ef8 100644 --- a/src/Codeception/Lib/Generator/PhpUnit.php +++ b/src/Codeception/Lib/Generator/PhpUnit.php @@ -26,8 +26,8 @@ protected function tearDown() public function testMe() { } - } + EOF; protected $settings; @@ -48,5 +48,4 @@ public function produce() ->place('name', $this->getShortClassName($this->name)) ->produce(); } - } diff --git a/src/Codeception/Lib/Generator/Shared/Classname.php b/src/Codeception/Lib/Generator/Shared/Classname.php index cba5f9f84b..f4a5a0ad7c 100644 --- a/src/Codeception/Lib/Generator/Shared/Classname.php +++ b/src/Codeception/Lib/Generator/Shared/Classname.php @@ -8,4 +8,4 @@ protected function removeSuffix($classname, $suffix) $classname = preg_replace('~\.php$~', '', $classname); return preg_replace("~$suffix$~", '', $classname); } -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Generator/StepObject.php b/src/Codeception/Lib/Generator/StepObject.php index a920744432..56d68dbe75 100644 --- a/src/Codeception/Lib/Generator/StepObject.php +++ b/src/Codeception/Lib/Generator/StepObject.php @@ -61,5 +61,4 @@ public function createAction($action) ->place('action', $action) ->produce(); } - } diff --git a/src/Codeception/Lib/Generator/Test.php b/src/Codeception/Lib/Generator/Test.php index 267dd6133e..9ca35ea9ed 100644 --- a/src/Codeception/Lib/Generator/Test.php +++ b/src/Codeception/Lib/Generator/Test.php @@ -34,7 +34,6 @@ public function testMe() { } - } EOF; @@ -63,5 +62,4 @@ public function produce() ->place('actor', lcfirst(Configuration::config()['actor'])) ->produce(); } - } diff --git a/src/Codeception/Lib/Interfaces/ActiveRecord.php b/src/Codeception/Lib/Interfaces/ActiveRecord.php index 5149d8c6d8..726110428e 100644 --- a/src/Codeception/Lib/Interfaces/ActiveRecord.php +++ b/src/Codeception/Lib/Interfaces/ActiveRecord.php @@ -10,5 +10,4 @@ public function seeRecord($model, $attributes = []); public function dontSeeRecord($model, $attributes = []); public function grabRecord($model, $attributes = []); - -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Interfaces/ConflictsWithModule.php b/src/Codeception/Lib/Interfaces/ConflictsWithModule.php index 2c072d8776..8f1795dea5 100644 --- a/src/Codeception/Lib/Interfaces/ConflictsWithModule.php +++ b/src/Codeception/Lib/Interfaces/ConflictsWithModule.php @@ -8,4 +8,4 @@ interface ConflictsWithModule * @return string */ public function _conflicts(); -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/Interfaces/Db.php b/src/Codeception/Lib/Interfaces/Db.php index 81de28aa3f..857bdc6776 100644 --- a/src/Codeception/Lib/Interfaces/Db.php +++ b/src/Codeception/Lib/Interfaces/Db.php @@ -1,5 +1,4 @@ getModuleConfig($moduleName); // skip config validation on dependent module - if (empty($config) and !$active) { + if (empty($config) && !$active) { $config = null; } @@ -136,7 +136,7 @@ private function instantiate($name, $class, $config) } } else { // skip if method is inherited and inheritActions == false - if (!$inherit and $method->getDeclaringClass() != $class) { + if (!$inherit && $method->getDeclaringClass() != $class) { continue; } } @@ -145,7 +145,7 @@ private function instantiate($name, $class, $config) continue; } - if ($module instanceof PartedModule and isset($config['part'])) { + if ($module instanceof PartedModule && isset($config['part'])) { if (!$this->moduleActionBelongsToPart($module, $method->name, $config['part'])) { continue; } @@ -240,6 +240,4 @@ protected function getModuleConfig($module) } return $config; } - - } \ No newline at end of file diff --git a/src/Codeception/Lib/Parser.php b/src/Codeception/Lib/Parser.php index 01c1739270..4f2853ea9c 100644 --- a/src/Codeception/Lib/Parser.php +++ b/src/Codeception/Lib/Parser.php @@ -7,7 +7,6 @@ class Parser { - protected $scenario; protected $code; @@ -82,7 +81,8 @@ public function parseSteps($code) } // friend's section start if (preg_match("~\\\$(.*?)->does\(~", $line, $matches)) { - if (!in_array($friend = $matches[1], $friends)) { + $friend = $matches[1]; + if (!in_array($friend, $friends)) { continue; } $isFriend = true; @@ -96,7 +96,7 @@ public function parseSteps($code) } // friend's section ends - if ($isFriend and strpos($line, '}') !== false) { + if ($isFriend && strpos($line, '}') !== false) { $this->addCommentStep("-------- back to me\n"); $isFriend = false; } @@ -193,5 +193,4 @@ protected function matchComments($code) } return $comments; } - } diff --git a/src/Codeception/Lib/Suite.php b/src/Codeception/Lib/Suite.php index 42c8210b21..7aec813d7f 100644 --- a/src/Codeception/Lib/Suite.php +++ b/src/Codeception/Lib/Suite.php @@ -37,6 +37,4 @@ public function setBaseName($baseName) { $this->baseName = $baseName; } - - -} \ No newline at end of file +} diff --git a/src/Codeception/Lib/TestLoader.php b/src/Codeception/Lib/TestLoader.php index 7c9d07f167..7c9b0e7a4b 100644 --- a/src/Codeception/Lib/TestLoader.php +++ b/src/Codeception/Lib/TestLoader.php @@ -38,7 +38,6 @@ */ class TestLoader { - protected static $formats = ['Cest', 'Cept', 'Test']; protected $tests = []; protected $path; @@ -209,7 +208,7 @@ protected function enhancePhpunitTest(\PHPUnit_Framework_TestCase $test) protected function createTestFromCestMethod($cestInstance, $methodName, $file) { - if ((strpos($methodName, '_') === 0) or ($methodName == '__construct')) { + if ((strpos($methodName, '_') === 0) || ($methodName == '__construct')) { return null; } $testClass = get_class($cestInstance); @@ -223,6 +222,4 @@ protected function createTestFromCestMethod($cestInstance, $methodName, $file) $cest->setDependencies(\PHPUnit_Util_Test::getDependencies($testClass, $methodName)); return $cest; } - - } diff --git a/src/Codeception/Module.php b/src/Codeception/Module.php index 967b6bbf15..bc18aa9266 100644 --- a/src/Codeception/Module.php +++ b/src/Codeception/Module.php @@ -1,5 +1,4 @@ 'locahost', @@ -87,12 +89,12 @@ public function _initialize() try { $this->connection = new AMQPConnection($host, $port, $username, $password, $vhost); - } catch (\Exception $e) { + } catch (Exception $e) { throw new ModuleException(__CLASS__, $e->getMessage() . ' while establishing connection to MQ server'); } } - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { if ($this->config['cleanup']) { $this->cleanup(); @@ -200,8 +202,8 @@ protected function cleanup() foreach ($this->config['queues'] as $queue) { try { $this->connection->channel()->queue_purge($queue); - } catch (\PhpAmqpLib\Exception\AMQPProtocolChannelException $e) { - # ignore if exchange/queue doesn't exist and rethrow exception if it's something else + } catch (AMQPProtocolChannelException $e) { + // ignore if exchange/queue doesn't exist and rethrow exception if it's something else if ($e->getCode() !== 404) { throw $e; } diff --git a/src/Codeception/Module/Asserts.php b/src/Codeception/Module/Asserts.php index e1a7f826eb..9fc7b21d76 100644 --- a/src/Codeception/Module/Asserts.php +++ b/src/Codeception/Module/Asserts.php @@ -1,15 +1,16 @@ output); } - } diff --git a/src/Codeception/Module/Db.php b/src/Codeception/Module/Db.php index bdf98d4e92..688148195f 100644 --- a/src/Codeception/Module/Db.php +++ b/src/Codeception/Module/Db.php @@ -1,6 +1,14 @@ config['dump'])) { throw new ModuleConfigException( - __CLASS__, - "\nFile with dump doesn't exist.\n" . - "Please, check path for sql file: " . $this->config['dump'] + __CLASS__, + "\nFile with dump doesn't exist.\n" + . "Please, check path for sql file: " + . $this->config['dump'] ); } $sql = file_get_contents(Configuration::projectDir() . $this->config['dump']); @@ -170,7 +172,7 @@ private function disconnect() $this->driver = null; } - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { if ($this->config['reconnect']) { $this->connect(); @@ -182,7 +184,7 @@ public function _before(\Codeception\TestCase $test) parent::_before($test); } - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { $this->populated = false; $this->removeInserted(); @@ -210,7 +212,7 @@ protected function cleanup() if (!$dbh) { throw new ModuleConfigException( __CLASS__, - "No connection to database. Remove this module from config if you don't need database repopulation" + 'No connection to database. Remove this module from config if you don\'t need database repopulation' ); } try { @@ -281,9 +283,9 @@ public function haveInDatabase($table, array $data) } $this->insertedIds[] = [ - 'table' => $table, - 'id' => $lastInsertId, - 'primary' => $this->driver->getPrimaryColumn($table) + 'table' => $table, + 'id' => $lastInsertId, + 'primary' => $this->driver->getPrimaryColumn($table) ]; return $lastInsertId; diff --git a/src/Codeception/Module/Dbh.php b/src/Codeception/Module/Dbh.php index 2eccc7e52b..743d248c97 100644 --- a/src/Codeception/Module/Dbh.php +++ b/src/Codeception/Module/Dbh.php @@ -1,6 +1,11 @@ inTransaction()) { + if (!self::$dbh->inTransaction()) { self::$dbh->beginTransaction(); } } - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { if (!self::$dbh) { - throw new \Codeception\Exception\ModuleConfigException( + throw new ModuleConfigException( __CLASS__, - "Transaction module requires PDO instance explicitly set.\n" . - "You can use your bootstrap file to assign the dbh:\n\n" . - '\Codeception\Module\Dbh::$dbh = $dbh' + "Transaction module requires PDO instance explicitly set.\n" + . "You can use your bootstrap file to assign the dbh:\n\n" + . '\Codeception\Module\Dbh::$dbh = $dbh' ); } @@ -98,17 +102,15 @@ public function dontSeeInDatabase($table, $criteria = []) protected function proceedSeeInDatabase($table, $column, $criteria) { - $query = "select %s from %s where %s"; - $params = []; foreach ($criteria as $k => $v) { $params[] = "$k = ?"; } - $params = implode('AND ', $params); + $sparams = implode('AND ', $params); - $query = sprintf($query, $column, $table, $params); + $query = sprintf('select %s from %s where %s', $column, $table, $sparams); - $this->debugSection('Query', $query, $params); + $this->debugSection('Query', $query, $sparams); $sth = self::$dbh->prepare($query); $sth->execute(array_values($criteria)); diff --git a/src/Codeception/Module/Doctrine2.php b/src/Codeception/Module/Doctrine2.php index 9bb641134d..12c8e3e8b7 100644 --- a/src/Codeception/Module/Doctrine2.php +++ b/src/Codeception/Module/Doctrine2.php @@ -1,9 +1,13 @@ true, 'connection_callback' => false, 'depends' => null]; + protected $config = [ + 'cleanup' => true, + 'connection_callback' => false, + 'depends' => null + ]; protected $dependencyMessage = <<em) { throw new ModuleConfigException( __CLASS__, - "EntityManager can't be obtained.\n \n" . - "Please specify either `connection_callback` config option\n" . - "with callable which will return instance of EntityManager or\n" . - "pass a dependent module which are Symfony2 or ZF2\n" . - "to connect to Doctrine using Dependency Injection Container" + "EntityManager can't be obtained.\n \n" + . "Please specify either `connection_callback` config option\n" + . "with callable which will return instance of EntityManager or\n" + . "pass a dependent module which are Symfony2 or ZF2\n" + . "to connect to Doctrine using Dependency Injection Container" ); } @@ -114,8 +121,8 @@ public function _beforeSuite($settings = []) if (!($this->em instanceof \Doctrine\ORM\EntityManager)) { throw new ModuleConfigException( __CLASS__, - "Connection object is not an instance of \\Doctrine\\ORM\\EntityManager.\n" . - "Use `connection_callback` or dependent framework modules to specify one" + "Connection object is not an instance of \\Doctrine\\ORM\\EntityManager.\n" + . "Use `connection_callback` or dependent framework modules to specify one" ); } @@ -125,7 +132,7 @@ public function _beforeSuite($settings = []) } } - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { if (!$this->em instanceof \Doctrine\ORM\EntityManager) { return; @@ -223,13 +230,14 @@ public function haveFakeRepository($classname, $methods = []) $customRepositoryClassName = '\Doctrine\ORM\EntityRepository'; } - $mock = \Codeception\Util\Stub::make( + $mock = Stub::make( $customRepositoryClassName, array_merge( [ '_entityName' => $metadata->name, - '_em' => $em, - '_class' => $metadata - ], $methods + '_em' => $em, + '_class' => $metadata + ], + $methods ) ); $em->clear(); @@ -393,7 +401,6 @@ protected function buildAssociationQuery($qb, $assoc, $alias, $params) $qb->andWhere("s.$key = :$paramname"); $qb->setParameter($paramname, $val); } - } } } diff --git a/src/Codeception/Module/FTP.php b/src/Codeception/Module/FTP.php index 89064fb43d..7aa6e8685b 100644 --- a/src/Codeception/Module/FTP.php +++ b/src/Codeception/Module/FTP.php @@ -1,6 +1,9 @@ loginAs($this->config['user'], $this->config['password']); diff --git a/src/Codeception/Module/Facebook.php b/src/Codeception/Module/Facebook.php index 82d884b57a..9ca1a3368a 100644 --- a/src/Codeception/Module/Facebook.php +++ b/src/Codeception/Module/Facebook.php @@ -1,5 +1,4 @@ path = \Codeception\Configuration::projectDir(); + $this->path = Configuration::projectDir(); } /** @@ -272,6 +275,4 @@ public function writeToFile($filename, $contents) { file_put_contents($filename, $contents); } - - } diff --git a/src/Codeception/Module/Laravel4.php b/src/Codeception/Module/Laravel4.php index 95f55d4882..d772fc926b 100644 --- a/src/Codeception/Module/Laravel4.php +++ b/src/Codeception/Module/Laravel4.php @@ -3,13 +3,19 @@ use Codeception\Exception\ModuleConfig; use Codeception\Lib\Connector\Laravel4 as LaravelConnector; -use Codeception\Lib\Connector\LaravelMemorySessionHandler; use Codeception\Lib\Framework; use Codeception\Lib\Interfaces\ActiveRecord; use Codeception\Lib\Interfaces\PartedModule; use Codeception\Lib\ModuleContainer; +use Codeception\Configuration; +use Codeception\TestCase; +use Codeception\Step; use Codeception\Subscriber\ErrorHandler; use Illuminate\Support\Facades\Facade; +use Illuminate\Support\ClassLoader; +use Illuminate\Workbench\Starter; +use Illuminate\Foundation\Application; +use Illuminate\Auth\UserInterface; use Symfony\Component\Console\Output\BufferedOutput; /** @@ -80,7 +86,7 @@ public function __construct(ModuleContainer $container, $config = null) (array) $config ); - $projectDir = explode('workbench', \Codeception\Configuration::projectDir())[0]; + $projectDir = explode('workbench', Configuration::projectDir())[0]; $projectDir .= $this->config['root']; $this->config['project_dir'] = $projectDir; @@ -117,7 +123,7 @@ protected function revertErrorHandler() * @param \Codeception\TestCase $test * @throws ModuleConfig */ - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { if ($this->config['filters']) { $this->haveEnabledFilters(); @@ -133,7 +139,7 @@ public function _before(\Codeception\TestCase $test) * * @param \Codeception\TestCase $test */ - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { if ($this->app['db'] && $this->cleanupDatabase()) { $this->app['db']->rollback(); @@ -145,7 +151,7 @@ public function _after(\Codeception\TestCase $test) * * @param \Codeception\Step $step */ - public function _beforeStep(\Codeception\Step $step) + public function _beforeStep(Step $step) { parent::_beforeStep($step); @@ -160,7 +166,7 @@ public function _beforeStep(\Codeception\Step $step) * * @param \Codeception\Step $step */ - public function _afterStep(\Codeception\Step $step) + public function _afterStep(Step $step) { parent::_beforeStep($step); @@ -179,7 +185,9 @@ public function checkStartFileExists() if (! file_exists($startFile)) { throw new ModuleConfig( - $this, "Laravel bootstrap start.php file not found in $startFile.\nPlease provide a valid path to it using 'start' config param. " + $this, + "Laravel bootstrap start.php file not found in $startFile.\n" + . "Please provide a valid path to it using 'start' config param. " ); } } @@ -191,10 +199,10 @@ protected function registerAutoloaders() { require $this->config['project_dir'] . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; - \Illuminate\Support\ClassLoader::register(); + ClassLoader::register(); if (is_dir($workbench = $this->config['project_dir'] . 'workbench')) { - \Illuminate\Workbench\Starter::start($workbench); + Starter::start($workbench); } } @@ -219,7 +227,7 @@ protected function cleanupDatabase() */ protected function databaseTransactionsSupported() { - return version_compare(\Illuminate\Foundation\Application::VERSION, '4.0.6', '>='); + return version_compare(Application::VERSION, '4.0.6', '>='); } /** @@ -499,7 +507,7 @@ public function seeFormErrorMessage($key, $errorMessage) */ public function amLoggedAs($user, $driver = null) { - if ($user instanceof \Illuminate\Auth\UserInterface) { + if ($user instanceof UserInterface) { $this->app['auth']->driver($driver)->login($user); } else { $this->app['auth']->driver($driver)->attempt($user); @@ -683,5 +691,4 @@ public function callArtisan($command, array $parameters = array()) return $output->fetch(); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Module/Laravel5.php b/src/Codeception/Module/Laravel5.php index f9764b6b6a..cb59906dce 100644 --- a/src/Codeception/Module/Laravel5.php +++ b/src/Codeception/Module/Laravel5.php @@ -7,6 +7,11 @@ use Codeception\Lib\Interfaces\ActiveRecord; use Codeception\Lib\Interfaces\PartedModule; use Codeception\Lib\ModuleContainer; +use Codeception\TestCase; +use Codeception\Step; +use Codeception\Configuration; +use Illuminate\Support\ClassLoader; +use Illuminate\Support\Facades\Facade; use Codeception\Subscriber\ErrorHandler; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Http\Request; @@ -100,7 +105,7 @@ public function _initialize() * @param \Codeception\TestCase $test * @throws ModuleConfigException */ - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { $this->initializeLaravel(); @@ -114,7 +119,7 @@ public function _before(\Codeception\TestCase $test) * * @param \Codeception\TestCase $test */ - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { if ($this->app['db'] && $this->config['cleanup']) { $this->app['db']->rollback(); @@ -148,9 +153,9 @@ public function _parts() * * @param \Codeception\Step $step */ - public function _afterStep(\Codeception\Step $step) + public function _afterStep(Step $step) { - \Illuminate\Support\Facades\Facade::clearResolvedInstances(); + Facade::clearResolvedInstances(); parent::_afterStep($step); } @@ -185,17 +190,19 @@ protected function initializeLaravel() */ protected function bootApplication() { - $projectDir = explode($this->config['packages'], \Codeception\Configuration::projectDir())[0]; + $projectDir = explode($this->config['packages'], Configuration::projectDir())[0]; $projectDir .= $this->config['root']; require $projectDir . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; - \Illuminate\Support\ClassLoader::register(); + ClassLoader::register(); $bootstrapFile = $projectDir . $this->config['bootstrap']; if (!file_exists($bootstrapFile)) { throw new ModuleConfigException( - $this, "Laravel bootstrap file not found in $bootstrapFile.\nPlease provide a valid path to it using 'bootstrap' config param. " + $this, + "Laravel bootstrap file not found in $bootstrapFile.\n" + . "Please provide a valid path to it using 'bootstrap' config param. " ); } @@ -443,7 +450,6 @@ public function seeFormErrorMessages(array $bindings) public function seeFormErrorMessage($key, $errorMessage) { $viewErrorBag = $this->app['view']->shared('errors'); - $this->assertEquals($errorMessage, $viewErrorBag->first($key)); } @@ -616,5 +622,4 @@ protected function findRecord($tableName, $attributes = array()) } return $query->first(); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Module/Lumen.php b/src/Codeception/Module/Lumen.php index 9d86e7656e..da3f06c8bb 100644 --- a/src/Codeception/Module/Lumen.php +++ b/src/Codeception/Module/Lumen.php @@ -5,6 +5,9 @@ use Codeception\Lib\Connector\Lumen as LumenConnector; use Codeception\Lib\Framework; use Codeception\Lib\Interfaces\ActiveRecord; +use Codeception\TestCase; +use Codeception\Step; +use Codeception\Configuration; use Codeception\Lib\ModuleContainer; use Codeception\Subscriber\ErrorHandler; use Illuminate\Contracts\Auth\Authenticatable; @@ -86,7 +89,7 @@ public function _initialize() * @param \Codeception\TestCase $test * @throws ModuleConfig */ - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { $this->initializeLumen(); @@ -100,7 +103,7 @@ public function _before(\Codeception\TestCase $test) * * @param \Codeception\TestCase $test */ - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { if ($this->app['db'] && $this->config['cleanup']) { $this->app['db']->rollback(); @@ -117,7 +120,7 @@ public function _after(\Codeception\TestCase $test) * * @param \Codeception\Step $step */ - public function _afterStep(\Codeception\Step $step) + public function _afterStep(Step $step) { Facade::clearResolvedInstances(); } @@ -145,7 +148,7 @@ protected function initializeLumen() */ protected function bootApplication() { - $projectDir = explode($this->config['packages'], \Codeception\Configuration::projectDir())[0]; + $projectDir = explode($this->config['packages'], Configuration::projectDir())[0]; $projectDir .= $this->config['root']; require $projectDir . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; @@ -153,7 +156,9 @@ protected function bootApplication() if (! file_exists($bootstrapFile)) { throw new ModuleConfig( - $this, "Laravel bootstrap file not found in $bootstrapFile.\nPlease provide a valid path to it using 'bootstrap' config param. " + $this, + "Laravel bootstrap file not found in $bootstrapFile.\n" + . "Please provide a valid path to it using 'bootstrap' config param. " ); } @@ -448,5 +453,4 @@ protected function findRecord($tableName, $attributes = array()) } return $query->first(); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Module/Memcache.php b/src/Codeception/Module/Memcache.php index fdc07dd435..225b64ea87 100644 --- a/src/Codeception/Module/Memcache.php +++ b/src/Codeception/Module/Memcache.php @@ -1,6 +1,10 @@ 'localhost', 'port' => 11211]; - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { if (class_exists('\Memcache')) { $this->memcache = new \Memcache; @@ -44,11 +47,11 @@ public function _before(\Codeception\TestCase $test) $this->memcache = new \Memcached; $this->memcache->addServer($this->config['host'], $this->config['port']); } else { - throw new \Codeception\Exception\ModuleConfigException(__CLASS__, 'Memcache classes not loaded'); + throw new ModuleConfigException(__CLASS__, 'Memcache classes not loaded'); } } - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { $this->memcache->flush(); } @@ -107,5 +110,4 @@ public function clearMemcache() { $this->memcache->flush(); } - } diff --git a/src/Codeception/Module/MongoDb.php b/src/Codeception/Module/MongoDb.php index b8611de291..1db61f1a84 100644 --- a/src/Codeception/Module/MongoDb.php +++ b/src/Codeception/Module/MongoDb.php @@ -1,6 +1,13 @@ driver = MongoDbDriver::create($this->config['dsn'], $this->config['user'], $this->config['password']); + $this->driver = MongoDbDriver::create( + $this->config['dsn'], + $this->config['user'], + $this->config['password'] + ); } catch (\MongoConnectionException $e) { throw new ModuleException(__CLASS__, $e->getMessage() . ' while creating Mongo connection'); } @@ -107,7 +112,7 @@ public function _initialize() } } - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { if ($this->config['cleanup'] && !$this->populated) { $this->cleanup(); @@ -115,7 +120,7 @@ public function _before(\Codeception\TestCase $test) } } - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { $this->populated = false; } @@ -124,7 +129,10 @@ protected function cleanup() { $dbh = $this->driver->getDbh(); if (!$dbh) { - throw new ModuleConfigException(__CLASS__, "No connection to database. Remove this module from config if you don't need database repopulation"); + throw new ModuleConfigException( + __CLASS__, + "No connection to database. Remove this module from config if you don't need database repopulation" + ); } try { $this->driver->cleanup(); @@ -254,9 +262,19 @@ public function seeElementIsArray($collection, $criteria = [], $elementToCheck = { $collection = $this->driver->getDbh()->selectCollection($collection); - $res = $collection->count(array_merge($criteria, [$elementToCheck => ['$exists' => true], '$where' => "Array.isArray(this.{$elementToCheck})"])); + $res = $collection->count( + array_merge( + $criteria, + [ + $elementToCheck => ['$exists' => true], + '$where' => "Array.isArray(this.{$elementToCheck})" + ] + ) + ); if ($res > 1) { - throw new \PHPUnit_Framework_ExpectationFailedException('Error: you should test against a single element criteria when asserting that elementIsArray'); + throw new \PHPUnit_Framework_ExpectationFailedException( + 'Error: you should test against a single element criteria when asserting that elementIsArray' + ); } \PHPUnit_Framework_Assert::assertEquals(1, $res, 'Specified element is not a Mongo Object'); } @@ -277,9 +295,19 @@ public function seeElementIsObject($collection, $criteria = [], $elementToCheck { $collection = $this->driver->getDbh()->selectCollection($collection); - $res = $collection->count(array_merge($criteria, [$elementToCheck => ['$exists' => true], '$where' => "! Array.isArray(this.{$elementToCheck}) && isObject(this.{$elementToCheck})"])); + $res = $collection->count( + array_merge( + $criteria, + [ + $elementToCheck => ['$exists' => true], + '$where' => "! Array.isArray(this.{$elementToCheck}) && isObject(this.{$elementToCheck})" + ] + ) + ); if ($res > 1) { - throw new \PHPUnit_Framework_ExpectationFailedException('Error: you should test against a single element criteria when asserting that elementIsObject'); + throw new \PHPUnit_Framework_ExpectationFailedException( + 'Error: you should test against a single element criteria when asserting that elementIsObject' + ); } \PHPUnit_Framework_Assert::assertEquals(1, $res, 'Specified element is not a Mongo Object'); } @@ -303,5 +331,4 @@ public function seeNumElementsInCollection($collection, $expected, $criteria = [ $res = $collection->count($criteria); \PHPUnit_Framework_Assert::assertSame($expected, $res); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Module/Phalcon1.php b/src/Codeception/Module/Phalcon1.php index 674d59d3c4..249728d383 100644 --- a/src/Codeception/Module/Phalcon1.php +++ b/src/Codeception/Module/Phalcon1.php @@ -1,5 +1,4 @@ config['bootstrap'])) { + if (!file_exists(Configuration::projectDir() . $this->config['bootstrap'])) { throw new ModuleConfigException( __CLASS__, - "Bootstrap file does not exist in " . $this->config['bootstrap'] . "\n" . - "Please create the bootstrap file that returns Application object\n" . - "And specify path to it with 'bootstrap' config\n\n" . - "Sample bootstrap: \n\nconfig['bootstrap'] . "\n" + . "Please create the bootstrap file that returns Application object\n" + . "And specify path to it with 'bootstrap' config\n\n" + . "Sample bootstrap: \n\ndi['db']->getTransactionLevel(); try { $this->di['db']->rollback(true); - } catch (\PDOException $e) { + } catch (PDOException $e) { } if ($level == $this->di['db']->getTransactionLevel()) { break; @@ -349,9 +347,9 @@ protected function findRecord($model, $attributes = []) foreach ($attributes as $key => $value) { $query[] = "$key = '$value'"; } - $query = implode(' AND ', $query); - $this->debugSection('Query', $query); - return call_user_func_array([$model, 'findFirst'], [$query]); + $squery = implode(' AND ', $query); + $this->debugSection('Query', $squery); + return call_user_func_array([$model, 'findFirst'], [$squery]); } /** @@ -400,6 +398,5 @@ protected function getModelIdentity(PhalconModel $model) default: return array_intersect_key(get_object_vars($model), array_flip($primaryKeys)); } - } } diff --git a/src/Codeception/Module/PhpBrowser.php b/src/Codeception/Module/PhpBrowser.php index f9fbb283e6..1720730801 100644 --- a/src/Codeception/Module/PhpBrowser.php +++ b/src/Codeception/Module/PhpBrowser.php @@ -1,5 +1,4 @@ true ]; - protected $guzzleConfigFields = ['headers', 'auth', 'proxy', 'verify', 'cert', 'query', 'ssl_key', 'proxy', 'expect', 'version', 'cookies', 'timeout', 'connect_timeout']; + protected $guzzleConfigFields = [ + 'headers', + 'auth', + 'proxy', + 'verify', + 'cert', + 'query', + 'ssl_key', + 'proxy', + 'expect', + 'version', + 'cookies', + 'timeout', + 'connect_timeout' + ]; /** * @var \Codeception\Lib\Connector\Guzzle6 @@ -255,8 +268,8 @@ public function _initializeSession() public function _backupSession() { return [ - 'client' => $this->client, - 'guzzle' => $this->guzzle, + 'client' => $this->client, + 'guzzle' => $this->guzzle, 'crawler' => $this->crawler ]; } diff --git a/src/Codeception/Module/Queue.php b/src/Codeception/Module/Queue.php index d4d237d908..d172487085 100644 --- a/src/Codeception/Module/Queue.php +++ b/src/Codeception/Module/Queue.php @@ -1,6 +1,8 @@ 'us-west-2' * */ -class Queue extends \Codeception\Module +class Queue extends CodeceptionModule { - /** * @var \Codeception\Lib\Interfaces\Queue */ @@ -98,7 +99,7 @@ class Queue extends \Codeception\Module * * @param \Codeception\TestCase $test */ - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { $this->queueDriver->openConnection($this->config); } @@ -134,7 +135,8 @@ protected function createQueueDriver() return new Beanstalk(); default: throw new ModuleConfigException( - __CLASS__, "Unknown queue type {$this->config}; Supported queue types are: aws, iron, beanstalk" + __CLASS__, + "Unknown queue type {$this->config}; Supported queue types are: aws, iron, beanstalk" ); } } @@ -360,5 +362,4 @@ public function grabQueueTotalCount($queue) { return $this->queueDriver->getMessagesTotalCountOnQueue($queue); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Module/REST.php b/src/Codeception/Module/REST.php index f54b6d4817..d350c66c8d 100644 --- a/src/Codeception/Module/REST.php +++ b/src/Codeception/Module/REST.php @@ -1,7 +1,8 @@ '', @@ -84,8 +85,7 @@ class REST extends \Codeception\Module implements DependsOnModule, PartedModule public $params = []; public $response = ""; - - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { $this->client = &$this->connectionModule->client; $this->resetVariables(); @@ -496,8 +496,7 @@ protected function encodeApplicationJson($method, $parameters) if ($method != 'GET' && array_key_exists('Content-Type', $this->headers) && ($this->headers['Content-Type'] === 'application/json' || preg_match('!^application/.+\+json$!', $this->headers['Content-Type']) - ) - + ) ) { if ($parameters instanceof \JsonSerializable) { return json_encode($parameters); @@ -952,5 +951,4 @@ public function dontSeeXmlResponseIncludes($xml) { $this->assertNotContains(XmlUtils::toXml($xml)->C14N(), XmlUtils::toXml($this->response)->C14N(), "found in XML Response"); } - } diff --git a/src/Codeception/Module/Redis.php b/src/Codeception/Module/Redis.php index 9bad2b3514..889629752e 100644 --- a/src/Codeception/Module/Redis.php +++ b/src/Codeception/Module/Redis.php @@ -2,6 +2,8 @@ namespace Codeception\Module; +use Codeception\Module as CodeceptionModule; +use Codeception\TestCase; use Codeception\Exception\ModuleException as ModuleException; use Codeception\Lib\Driver\Redis as RedisDriver; @@ -32,7 +34,7 @@ * * @author judgedim */ -class Redis extends \Codeception\Module +class Redis extends CodeceptionModule { protected $config = [ 'cleanup' => true @@ -53,10 +55,9 @@ public function _initialize() } catch (\Exception $e) { throw new ModuleException(__CLASS__, $e->getMessage()); } - } - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { if ($this->config['cleanup']) { $this->cleanup(); @@ -64,7 +65,7 @@ public function _before(\Codeception\TestCase $test) parent::_before($test); } - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { parent::_after($test); } @@ -85,5 +86,4 @@ protected function cleanup() throw new ModuleException(__CLASS__, $e->getMessage()); } } - } diff --git a/src/Codeception/Module/SOAP.php b/src/Codeception/Module/SOAP.php index 4edd4947f4..f9d2795d40 100644 --- a/src/Codeception/Module/SOAP.php +++ b/src/Codeception/Module/SOAP.php @@ -1,6 +1,15 @@ "", + 'schema_url' => 'http://schemas.xmlsoap.org/soap/envelope/', + 'framework_collect_buffer' => true + ]; + + protected $requiredFields = ['endpoint']; + protected $dependencyMessage = << "", 'schema_url' => 'http://schemas.xmlsoap.org/soap/envelope/', 'framework_collect_buffer' => true]; - protected $requiredFields = ['endpoint']; /** * @var \Symfony\Component\BrowserKit\Client */ @@ -81,7 +86,7 @@ class SOAP extends \Codeception\Module */ protected $connectionModule; - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { $this->client = &$this->connectionModule->client; $this->buildRequest(); @@ -377,7 +382,11 @@ public function dontSeeSoapResponseContainsXPath($xpath) */ public function seeResponseCodeIs($code) { - $this->assertEquals($code, $this->client->getInternalResponse()->getStatus(), "soap response code matches expected"); + $this->assertEquals( + $code, + $this->client->getInternalResponse()->getStatus(), + "soap response code matches expected" + ); } /** @@ -446,11 +455,12 @@ protected function processRequest($action, $body) $this->getClient()->request( 'POST', $this->config['endpoint'], - [], [], + [], + [], [ - "HTTP_Content-Type" => "text/xml; charset=UTF-8", + 'HTTP_Content-Type' => 'text/xml; charset=UTF-8', 'HTTP_Content-Length' => strlen($body), - 'HTTP_SOAPAction' => $action + 'HTTP_SOAPAction' => $action ], $body ); @@ -479,5 +489,4 @@ protected function processExternalRequest($action, $body) $this->processRequest($action, $body); return $this->client->getInternalResponse()->getContent(); } - } diff --git a/src/Codeception/Module/Sequence.php b/src/Codeception/Module/Sequence.php index 3a9cdf5d8d..2a02ad8676 100644 --- a/src/Codeception/Module/Sequence.php +++ b/src/Codeception/Module/Sequence.php @@ -1,6 +1,7 @@ app; - $this->client = new \Symfony\Component\HttpKernel\Client($this->app); + $this->client = new Client($this->app); } /** @@ -95,5 +96,4 @@ public function grabService($service) { return $this->app[$service]; } - } diff --git a/src/Codeception/Module/Symfony2.php b/src/Codeception/Module/Symfony2.php index 0ad77a614e..b0d62730c8 100644 --- a/src/Codeception/Module/Symfony2.php +++ b/src/Codeception/Module/Symfony2.php @@ -1,13 +1,13 @@ config['var_path'] . DIRECTORY_SEPARATOR . 'bootstrap.php.cache'; + $cache = Configuration::projectDir() . $this->config['var_path'] . DIRECTORY_SEPARATOR . 'bootstrap.php.cache'; if (!file_exists($cache)) { throw new ModuleRequireException(__CLASS__, 'Symfony2 bootstrap file not found in ' . $cache); } @@ -105,7 +104,7 @@ public function _initialize() ini_set('xdebug.max_nesting_level', 200); // Symfony may have very long nesting level } - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { $this->kernel->boot(); $this->container = $this->kernel->getContainer(); diff --git a/src/Codeception/Module/WebDriver.php b/src/Codeception/Module/WebDriver.php index 101ffba5a9..1b91258cf1 100644 --- a/src/Codeception/Module/WebDriver.php +++ b/src/Codeception/Module/WebDriver.php @@ -1,6 +1,8 @@ webDriver)) { $this->_initialize(); @@ -180,7 +188,7 @@ protected function initialWindowSize() } } - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { if ($this->config['restart'] && isset($this->webDriver)) { $this->webDriver->quit(); @@ -194,10 +202,9 @@ public function _after(\Codeception\TestCase $test) } } - public function _failed(\Codeception\TestCase $test, $fail) + public function _failed(TestCase $test, $fail) { - - $filename = str_replace(['::', '\\', '/'], ['.', '', ''], \Codeception\TestCase::getTestSignature($test)) . '.fail'; + $filename = str_replace(['::', '\\', '/'], ['.', '', ''], TestCase::getTestSignature($test)) . '.fail'; $this->_saveScreenshot(codecept_output_dir() . $filename . '.png'); $this->_savePageSource(codecept_output_dir() . $filename . '.html'); $this->debug("Screenshot and page source were saved into '_output' dir"); @@ -347,7 +354,8 @@ protected function filterCookies($cookies, $params = []) continue; } $cookies = array_filter( - $cookies, function ($item) use ($filter, $params) { + $cookies, + function ($item) use ($filter, $params) { return $item[$filter] == $params[$filter]; } ); @@ -358,7 +366,7 @@ protected function filterCookies($cookies, $params = []) public function amOnUrl($url) { $urlParts = parse_url($url); - if (!isset($urlParts['host']) or !isset($urlParts['scheme'])) { + if (!isset($urlParts['host']) || !isset($urlParts['scheme'])) { throw new TestRuntimeException("Wrong URL passes, host and scheme not set"); } $host = $urlParts['scheme'] . '://' . $urlParts['host']; @@ -679,6 +687,7 @@ protected function proceedSeeInFormFields($formSelector, array $params, $assertN } } } + protected function proceedSeeInField(array $elements, $value) { $strField = reset($elements)->getAttribute('name'); @@ -719,7 +728,6 @@ protected function proceedSeeInField(array $elements, $value) ]; } - public function selectOption($select, $option) { $el = $this->findField($select); @@ -1109,7 +1117,6 @@ function ($e) { $this->assertNodesContain($optionText, $select->getAllSelectedOptions(), 'option'); } - public function dontSeeOptionIsSelected($selector, $optionText) { $el = $this->findField($selector); diff --git a/src/Codeception/Module/XMLRPC.php b/src/Codeception/Module/XMLRPC.php index d2b950a268..b3cb7d7b0e 100644 --- a/src/Codeception/Module/XMLRPC.php +++ b/src/Codeception/Module/XMLRPC.php @@ -2,8 +2,11 @@ namespace Codeception\Module; -use Codeception\Exception\ModuleConfigException as ModuleConfigException; -use Codeception\Exception\ModuleRequireException as ModuleRequireException; +use Codeception\Module as CodeceptionModule; +use Codeception\Lib\Framework; +use Codeception\Exception\ModuleConfigException; +use Codeception\Exception\ModuleRequireException; +use Codeception\TestCase; /** * Module for testing XMLRPC WebService. @@ -37,7 +40,7 @@ * @since 1.1.5 * @author tiger.seo@gmail.com */ -class XMLRPC extends \Codeception\Module +class XMLRPC extends CodeceptionModule { protected $config = ['url' => ""]; @@ -59,13 +62,13 @@ public function _initialize() parent::_initialize(); } - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { if (!$this->client) { if (!strpos($this->config['url'], '://')) { // not valid url foreach ($this->getModules() as $module) { - if ($module instanceof \Codeception\Lib\Framework) { + if ($module instanceof Framework) { $this->client = $module->client; $this->is_functional = true; break; @@ -73,12 +76,19 @@ public function _before(\Codeception\TestCase $test) } } else { if (!$this->hasModule('PhpBrowser')) { - throw new ModuleConfigException(__CLASS__, "For XMLRPC testing via HTTP please enable PhpBrowser module"); + throw new ModuleConfigException( + __CLASS__, + "For XMLRPC testing via HTTP please enable PhpBrowser module" + ); } $this->client = $this->getModule('PhpBrowser')->client; } if (!$this->client) { - throw new ModuleConfigException(__CLASS__, "Client for XMLRPC requests not initialized.\nProvide either PhpBrowser module, or a framework module which shares FrameworkInterface"); + throw new ModuleConfigException( + __CLASS__, + "Client for XMLRPC requests not initialized.\n" + . "Provide either PhpBrowser module, or a framework module which shares FrameworkInterface" + ); } } @@ -150,6 +160,5 @@ public function sendXMLRPCMethodCall($methodName, $parameters = []) $this->response = $this->client->getInternalResponse()->getContent(); $this->debugSection('Response', $this->response); - } } diff --git a/src/Codeception/Module/Yii1.php b/src/Codeception/Module/Yii1.php index 4693dbbf08..972ab678e8 100644 --- a/src/Codeception/Module/Yii1.php +++ b/src/Codeception/Module/Yii1.php @@ -1,8 +1,10 @@ _appConfig = include($this->appSettings['config']); } - defined('YII_ENABLE_EXCEPTION_HANDLER') or define('YII_ENABLE_EXCEPTION_HANDLER', false); - defined('YII_ENABLE_ERROR_HANDLER') or define('YII_ENABLE_ERROR_HANDLER', false); + if (!defined('YII_ENABLE_EXCEPTION_HANDLER')) { + define('YII_ENABLE_EXCEPTION_HANDLER', false); + } + if (!defined('YII_ENABLE_ERROR_HANDLER')) { + define('YII_ENABLE_ERROR_HANDLER', false); + } $_SERVER['SCRIPT_NAME'] = parse_url($this->config['url'], PHP_URL_PATH); $_SERVER['SCRIPT_FILENAME'] = $this->config['appPath']; @@ -121,8 +127,9 @@ public function _initialize() if (!function_exists('launch_codeception_yii_bridge')) { throw new ModuleConfigException( __CLASS__, - "Codeception-Yii Bridge is not launched. In order to run tests you need to install https://github.com/Codeception/YiiBridge" . - "Implement function 'launch_codeception_yii_bridge' to load all Codeception overrides" + "Codeception-Yii Bridge is not launched. In order to run tests you need to install " + . "https://github.com/Codeception/YiiBridge Implement function 'launch_codeception_yii_bridge' to " + . "load all Codeception overrides" ); } launch_codeception_yii_bridge(); @@ -137,7 +144,7 @@ public function _initialize() */ public function _createClient() { - $this->client = new \Codeception\Lib\Connector\Yii1(); + $this->client = new Yii1Connector(); $this->client->appPath = $this->config['appPath']; $this->client->url = $this->config['url']; $this->client->appSettings = [ @@ -146,12 +153,12 @@ public function _createClient() ]; } - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { $this->_createClient(); } - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { $_SESSION = []; $_GET = []; @@ -161,5 +168,4 @@ public function _after(\Codeception\TestCase $test) Yii::app()->session->close(); parent::_after($test); } - } diff --git a/src/Codeception/Module/Yii2.php b/src/Codeception/Module/Yii2.php index 14b64d9cc7..5d5f0a2eb1 100644 --- a/src/Codeception/Module/Yii2.php +++ b/src/Codeception/Module/Yii2.php @@ -3,8 +3,12 @@ use Codeception\Exception\ModuleConfigException; use Codeception\Lib\Framework; +use Codeception\Configuration; +use Codeception\TestCase; use Codeception\Lib\Interfaces\ActiveRecord; use Codeception\Lib\Interfaces\PartedModule; +use Codeception\Lib\Connector\Yii2 as Yii2Connector; +use yii\db\ActiveRecordInterface; use Yii; /** @@ -51,23 +55,38 @@ class Yii2 extends Framework implements ActiveRecord, PartedModule public function _initialize() { - if (!is_file(\Codeception\Configuration::projectDir() . $this->config['configFile'])) { - throw new ModuleConfigException(__CLASS__, "The application config file does not exist: {$this->config['configFile']}"); + if (!is_file(Configuration::projectDir() . $this->config['configFile'])) { + throw new ModuleConfigException( + __CLASS__, + "The application config file does not exist: {$this->config['configFile']}" + ); } } - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { - $this->client = new \Codeception\Lib\Connector\Yii2(); - $this->client->configFile = \Codeception\Configuration::projectDir().$this->config['configFile']; - $mainConfig = \Codeception\Configuration::config(); + $this->client = new Yii2Connector(); + $this->client->configFile = Configuration::projectDir().$this->config['configFile']; + $mainConfig = Configuration::config(); if (isset($mainConfig['config']) && isset($mainConfig['config']['test_entry_url'])){ - $this->client->setServerParameter('HTTP_HOST', (string) parse_url($mainConfig['config']['test_entry_url'], PHP_URL_HOST)); - $this->client->setServerParameter('HTTPS', ((string) parse_url($mainConfig['config']['test_entry_url'], PHP_URL_SCHEME)) === 'https'); + $this->client->setServerParameter( + 'HTTP_HOST', + (string) parse_url( + $mainConfig['config']['test_entry_url'], + PHP_URL_HOST + ) + ); + $this->client->setServerParameter( + 'HTTPS', + ((string) parse_url( + $mainConfig['config']['test_entry_url'], + PHP_URL_SCHEME + )) === 'https' + ); } $this->app = $this->client->startApp(); - if ($this->config['cleanup'] and isset($this->app->db)) { + if ($this->config['cleanup'] && isset($this->app->db)) { $this->transaction = $this->app->db->beginTransaction(); } } @@ -80,7 +99,7 @@ public function _after(\Codeception\TestCase $test) $_POST = []; $_COOKIE = []; $_REQUEST = []; - if ($this->transaction and $this->config['cleanup']) { + if ($this->transaction && $this->config['cleanup']) { $this->transaction->rollback(); } @@ -194,7 +213,7 @@ protected function getModelRecord($model) throw new \RuntimeException("Model $model does not exist"); } $record = new $model; - if (!$record instanceof \yii\db\ActiveRecordInterface) { + if (!$record instanceof ActiveRecordInterface) { throw new \RuntimeException("Model $model is not implement interface \\yii\\db\\ActiveRecordInterface"); } return $record; @@ -216,7 +235,7 @@ protected function getModelRecord($model) public function amOnPage($page) { if (is_array($page)) { - $page = \Yii::$app->getUrlManager()->createUrl($page); + $page = Yii::$app->getUrlManager()->createUrl($page); } parent::amOnPage($page); } diff --git a/src/Codeception/Module/ZF1.php b/src/Codeception/Module/ZF1.php index fbda310b80..50ea6a9073 100644 --- a/src/Codeception/Module/ZF1.php +++ b/src/Codeception/Module/ZF1.php @@ -1,6 +1,12 @@ 'testing', 'config' => 'application/configs/application.ini', - 'app_path' => 'application', 'lib_path' => 'library' + 'env' => 'testing', + 'config' => 'application/configs/application.ini', + 'app_path' => 'application', + 'lib_path' => 'library' ]; /** @@ -102,16 +108,16 @@ public function _initialize() require_once 'Zend/Loader/Autoloader.php'; \Zend_Loader_Autoloader::getInstance(); - $this->client = new \Codeception\Lib\Connector\ZF1(); + $this->client = new ZF1Connector(); } - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { \Zend_Session::$_unitTestEnabled = true; try { $this->bootstrap = new \Zend_Application($this->config['env'], Configuration::projectDir() . $this->config['config']); } catch (\Exception $e) { - throw new \Codeception\Exception\ModuleException(__CLASS__, $e->getMessage()); + throw new ModuleException(__CLASS__, $e->getMessage()); } $this->bootstrap->bootstrap(); $this->client->setBootstrap($this->bootstrap); @@ -124,7 +130,7 @@ public function _before(\Codeception\TestCase $test) } } - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { $_SESSION = []; $_GET = []; @@ -161,5 +167,4 @@ protected function debugResponse() $this->queries = $profiler->getTotalNumQueries(); } } - } diff --git a/src/Codeception/Module/ZF2.php b/src/Codeception/Module/ZF2.php index 673c0380b5..7d393b9afc 100644 --- a/src/Codeception/Module/ZF2.php +++ b/src/Codeception/Module/ZF2.php @@ -1,12 +1,16 @@ 'tests/application.config.php', @@ -59,18 +63,18 @@ class ZF2 extends \Codeception\Lib\Framework implements DoctrineProvider public function _initialize() { - require \Codeception\Configuration::projectDir() . 'init_autoloader.php'; + require Configuration::projectDir() . 'init_autoloader.php'; - $this->client = new \Codeception\Lib\Connector\ZF2(); + $this->client = new ZF2Connector(); - $this->applicationConfig = require \Codeception\Configuration::projectDir() . $this->config['config']; + $this->applicationConfig = require Configuration::projectDir() . $this->config['config']; if (isset($applicationConfig['module_listener_options']['config_cache_enabled'])) { $applicationConfig['module_listener_options']['config_cache_enabled'] = false; } Console::overrideIsConsole(false); } - public function _before(\Codeception\TestCase $test) + public function _before(TestCase $test) { $this->application = Application::init($this->applicationConfig); $events = $this->application->getEventManager(); @@ -80,7 +84,7 @@ public function _before(\Codeception\TestCase $test) $_SERVER['REQUEST_URI'] = ''; } - public function _after(\Codeception\TestCase $test) + public function _after(TestCase $test) { $_SESSION = []; $_GET = []; @@ -92,7 +96,7 @@ public function _after(\Codeception\TestCase $test) // Reset singleton placeholder if version < 2.2.0, no longer required in 2.2.0+ if (Version::compareVersion('2.2.0') >= 0) { - Placeholder\Registry::unsetRegistry(); + Registry::unsetRegistry(); } //Close the session, if any are open if (session_status() == PHP_SESSION_ACTIVE) { @@ -106,6 +110,5 @@ public function _getEntityManager() { $serviceLocator = Application::init($this->applicationConfig)->getServiceManager(); return $serviceLocator->get('Doctrine\ORM\EntityManager'); - } } diff --git a/src/Codeception/PHPUnit/ConsolePrinter.php b/src/Codeception/PHPUnit/ConsolePrinter.php index 0262dfd711..ae17d3993f 100644 --- a/src/Codeception/PHPUnit/ConsolePrinter.php +++ b/src/Codeception/PHPUnit/ConsolePrinter.php @@ -12,4 +12,4 @@ interface ConsolePrinter public function write($buffer); public function printResult(\PHPUnit_Framework_TestResult $result); -} \ No newline at end of file +} diff --git a/src/Codeception/PHPUnit/Constraint/Crawler.php b/src/Codeception/PHPUnit/Constraint/Crawler.php index 5e52d446b2..e004267220 100644 --- a/src/Codeception/PHPUnit/Constraint/Crawler.php +++ b/src/Codeception/PHPUnit/Constraint/Crawler.php @@ -4,10 +4,10 @@ use Codeception\Exception\ElementNotFound; use Codeception\Lib\Console\Message; use Symfony\Component\DomCrawler\Crawler as DomCrawler; +use SebastianBergmann\Comparator\ComparisonFailure; class Crawler extends Page { - protected function matches($nodes) { /** @var $nodes DomCrawler * */ @@ -26,7 +26,7 @@ protected function matches($nodes) return false; } - protected function fail($nodes, $selector, \SebastianBergmann\Comparator\ComparisonFailure $comparisonFailure = null) + protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null) { /** @var $nodes DomCrawler * */ if (!$nodes->count()) { @@ -60,19 +60,15 @@ protected function failureDescription($other) return $desc; } - protected function nodesList(DOMCrawler $nodes, $contains = null) + protected function nodesList(DomCrawler $nodes, $contains = null) { $output = ""; foreach ($nodes as $node) { - if ($contains) { - if (strpos($node->nodeValue, $contains) === false) { - continue; - } + if ($contains && strpos($node->nodeValue, $contains) === false) { + continue; } $output .= "\n+ " . $node->C14N() . ""; } return $output; } - - -} \ No newline at end of file +} diff --git a/src/Codeception/PHPUnit/Constraint/CrawlerNot.php b/src/Codeception/PHPUnit/Constraint/CrawlerNot.php index 338c6fda4e..e5501b824b 100644 --- a/src/Codeception/PHPUnit/Constraint/CrawlerNot.php +++ b/src/Codeception/PHPUnit/Constraint/CrawlerNot.php @@ -1,17 +1,16 @@ string) { throw new \PHPUnit_Framework_ExpectationFailedException("Element '$selector' was found", $comparisonFailure); @@ -27,7 +26,6 @@ protected function fail($nodes, $selector, \SebastianBergmann\Comparator\Compari $output, $comparisonFailure ); - } public function toString() @@ -36,4 +34,4 @@ public function toString() return 'that contains text "' . $this->string . '"'; } } -} \ No newline at end of file +} diff --git a/src/Codeception/PHPUnit/Constraint/Page.php b/src/Codeception/PHPUnit/Constraint/Page.php index bd8a06704c..f84a616c2a 100644 --- a/src/Codeception/PHPUnit/Constraint/Page.php +++ b/src/Codeception/PHPUnit/Constraint/Page.php @@ -40,5 +40,4 @@ protected function uriMessage($onPage = "") $message->prepend(" $onPage "); return $message; } - } diff --git a/src/Codeception/PHPUnit/Constraint/WebDriver.php b/src/Codeception/PHPUnit/Constraint/WebDriver.php index cd6fd67acc..0db0000859 100644 --- a/src/Codeception/PHPUnit/Constraint/WebDriver.php +++ b/src/Codeception/PHPUnit/Constraint/WebDriver.php @@ -3,6 +3,7 @@ use Codeception\Exception\ElementNotFound; use Codeception\Lib\Console\Message; +use SebastianBergmann\Comparator\ComparisonFailure; class WebDriver extends Page { @@ -28,7 +29,7 @@ protected function matches($nodes) return false; } - protected function fail($nodes, $selector, \SebastianBergmann\Comparator\ComparisonFailure $comparisonFailure = null) + protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null) { if (!count($nodes)) { throw new ElementNotFound($selector, 'Element located either by name, CSS or XPath'); @@ -65,10 +66,8 @@ protected function nodesList($nodes, $contains = null) { $output = ""; foreach ($nodes as $node) { - if ($contains) { - if (strpos($node->getText(), $contains) === false) { - continue; - } + if ($contains && strpos($node->getText(), $contains) === false) { + continue; } /** @var $node \WebDriverElement * */ $message = new Message("<%s> %s"); diff --git a/src/Codeception/PHPUnit/Constraint/WebDriverNot.php b/src/Codeception/PHPUnit/Constraint/WebDriverNot.php index 5078d05524..43b865766b 100644 --- a/src/Codeception/PHPUnit/Constraint/WebDriverNot.php +++ b/src/Codeception/PHPUnit/Constraint/WebDriverNot.php @@ -1,15 +1,16 @@ string) { throw new \PHPUnit_Framework_ExpectationFailedException("Element '$selector' was found", $comparisonFailure); @@ -24,7 +25,6 @@ protected function fail($nodes, $selector, \SebastianBergmann\Comparator\Compari $output, $comparisonFailure ); - } public function toString() diff --git a/src/Codeception/PHPUnit/Listener.php b/src/Codeception/PHPUnit/Listener.php index 266aae425c..c162c307ec 100644 --- a/src/Codeception/PHPUnit/Listener.php +++ b/src/Codeception/PHPUnit/Listener.php @@ -16,7 +16,6 @@ class Listener implements \PHPUnit_Framework_TestListener /** * @var \Symfony\Component\EventDispatcher\EventDispatcher */ - protected $dispatcher; protected $unsuccessfulTests = []; diff --git a/src/Codeception/PHPUnit/Log/JUnit.php b/src/Codeception/PHPUnit/Log/JUnit.php index bc1d34d1ac..c6a73c0976 100644 --- a/src/Codeception/PHPUnit/Log/JUnit.php +++ b/src/Codeception/PHPUnit/Log/JUnit.php @@ -25,5 +25,4 @@ public function startTest(\PHPUnit_Framework_Test $test) $this->currentTestCase->setAttribute($attr, $value); } } - } diff --git a/src/Codeception/PHPUnit/ResultPrinter/HTML.php b/src/Codeception/PHPUnit/ResultPrinter/HTML.php index 789f2b7ab8..70aab14824 100644 --- a/src/Codeception/PHPUnit/ResultPrinter/HTML.php +++ b/src/Codeception/PHPUnit/ResultPrinter/HTML.php @@ -1,9 +1,11 @@ templatePath . 'substeps.html'); $metaTemplate->setVar(['metaStep' => $metaStep, 'steps' => $substepsBuffer, 'id' => uniqid()]); return $metaTemplate->render(); } - - } diff --git a/src/Codeception/PHPUnit/ResultPrinter/Report.php b/src/Codeception/PHPUnit/ResultPrinter/Report.php index b73413ecfe..59ec68537f 100644 --- a/src/Codeception/PHPUnit/ResultPrinter/Report.php +++ b/src/Codeception/PHPUnit/ResultPrinter/Report.php @@ -18,20 +18,14 @@ protected function onTest($name, $success = true, array $steps = [], $time = 0) { if ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) { $status = "\033[41;37mFAIL\033[0m"; + } elseif ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED) { + $status = 'Skipped'; + } elseif ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) { + $status = 'Incomplete'; + } elseif ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR) { + $status = 'ERROR'; } else { - if ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED) { - $status = 'Skipped'; - } else { - if ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) { - $status = 'Incomplete'; - } else { - if ($this->testStatus == \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR) { - $status = 'ERROR'; - } else { - $status = 'Ok'; - } - } - } + $status = 'Ok'; } if (strlen($name) > 75) { @@ -53,5 +47,4 @@ public function printResult(\PHPUnit_Framework_TestResult $result) { } - } diff --git a/src/Codeception/PHPUnit/ResultPrinter/UI.php b/src/Codeception/PHPUnit/ResultPrinter/UI.php index 88b232f179..a641e673c9 100644 --- a/src/Codeception/PHPUnit/ResultPrinter/UI.php +++ b/src/Codeception/PHPUnit/ResultPrinter/UI.php @@ -1,5 +1,4 @@ config['reporters'][$name])) { - throw new \Codeception\Exception\ConfigurationException("Reporter $name not defined"); + throw new ConfigurationException("Reporter $name not defined"); } return (new \ReflectionClass($this->config['reporters'][$name]))->newInstanceArgs($args); @@ -155,5 +156,4 @@ private function absolutePath($path) } return $this->logDir . $path; } - } diff --git a/src/Codeception/Platform/Extension.php b/src/Codeception/Platform/Extension.php index a3bbaa180c..ee55a986d0 100644 --- a/src/Codeception/Platform/Extension.php +++ b/src/Codeception/Platform/Extension.php @@ -1,13 +1,15 @@ getAction(); @@ -26,10 +26,8 @@ public function getPhpCode() return '// ' . $this->getAction(); } - public function run(ModuleContainer $container = null) { // don't do anything, let's rest } - } diff --git a/src/Codeception/Step/Condition.php b/src/Codeception/Step/Condition.php index 61aeb0abe0..9ad625b510 100644 --- a/src/Codeception/Step/Condition.php +++ b/src/Codeception/Step/Condition.php @@ -1,6 +1,8 @@ humanize($this->action . ' ' . $this->getHumanizedArguments()); } -} \ No newline at end of file +} diff --git a/src/Codeception/Step/Executor.php b/src/Codeception/Step/Executor.php index 4370447ac4..8a0d5a82cb 100644 --- a/src/Codeception/Step/Executor.php +++ b/src/Codeception/Step/Executor.php @@ -1,9 +1,10 @@ getAction(); } - } diff --git a/src/Codeception/Step/Meta.php b/src/Codeception/Step/Meta.php index da4247997c..58c34ce050 100644 --- a/src/Codeception/Step/Meta.php +++ b/src/Codeception/Step/Meta.php @@ -1,13 +1,13 @@ actor = $actor; } - -} \ No newline at end of file +} diff --git a/src/Codeception/Step/Skip.php b/src/Codeception/Step/Skip.php index d0f0d078e9..10b84c0dd8 100644 --- a/src/Codeception/Step/Skip.php +++ b/src/Codeception/Step/Skip.php @@ -1,9 +1,10 @@ getAction(); } - } diff --git a/src/Codeception/Subscriber/AutoRebuild.php b/src/Codeception/Subscriber/AutoRebuild.php index a69f8dd750..ce07c399d3 100644 --- a/src/Codeception/Subscriber/AutoRebuild.php +++ b/src/Codeception/Subscriber/AutoRebuild.php @@ -5,7 +5,6 @@ use Codeception\Event\SuiteEvent; use Codeception\Events; use Codeception\Lib\Generator\Actions; -use Codeception\SuiteManager; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class AutoRebuild implements EventSubscriberInterface @@ -21,7 +20,8 @@ public function updateActor(SuiteEvent $e) $settings = $e->getSettings(); $modules = $e->getSuite()->getModules(); - $actorFile = Configuration::supportDir() . '_generated' . DIRECTORY_SEPARATOR . $settings['class_name'] . 'Actions.php'; + $actorFile = Configuration::supportDir() . '_generated' . DIRECTORY_SEPARATOR + . $settings['class_name'] . 'Actions.php'; // load guy class to see hash $handle = @fopen($actorFile, "r"); @@ -44,4 +44,4 @@ public function updateActor(SuiteEvent $e) @fclose($handle); } } -} \ No newline at end of file +} diff --git a/src/Codeception/Subscriber/Bootstrap.php b/src/Codeception/Subscriber/Bootstrap.php index bad66cc3b3..6e91ad06c5 100644 --- a/src/Codeception/Subscriber/Bootstrap.php +++ b/src/Codeception/Subscriber/Bootstrap.php @@ -3,7 +3,7 @@ use Codeception\Event\SuiteEvent; use Codeception\Events; -use Codeception\Exception\ConfigurationException as ConfigurationException; +use Codeception\Exception\ConfigurationException; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class Bootstrap implements EventSubscriberInterface @@ -33,4 +33,4 @@ public function loadBootstrap(SuiteEvent $e) require_once $bootstrap; } -} \ No newline at end of file +} diff --git a/src/Codeception/Subscriber/Console.php b/src/Codeception/Subscriber/Console.php index 65f02fafc4..546713596d 100644 --- a/src/Codeception/Subscriber/Console.php +++ b/src/Codeception/Subscriber/Console.php @@ -104,7 +104,6 @@ function ($module) { } $this->message('')->width(array_sum($this->columns), '-')->writeln(OutputInterface::VERBOSITY_VERBOSE); - } // triggered for all tests @@ -128,7 +127,6 @@ public function before(TestEvent $e) if ($this->steps && $this->isDetailed($test)) { $this->output->writeln("\nScenario:"); } - } public function afterStep(StepEvent $e) @@ -292,7 +290,7 @@ protected function printException($e, $cause = null) if (!$isFailure) { $message->prepend("[$class] ")->block("error"); } - if ($isFailure and $cause) { + if ($isFailure && $cause) { $message->prepend(" Step $cause\n Fail "); } if ($e instanceof \PHPUnit_Framework_ExpectationFailedException) { @@ -316,7 +314,7 @@ protected function printScenarioFail(ScenarioDriven $failedTest, $fail) ->append(')'); if ($fail instanceof \PHPUnit_Framework_SkippedTest - or $fail instanceof \PHPUnit_Framework_IncompleteTest + || $fail instanceof \PHPUnit_Framework_IncompleteTest ) { $this->printSkippedTest($feature, $failedTest->getFileName(), $failToString); return; @@ -348,7 +346,6 @@ protected function printScenarioFail(ScenarioDriven $failedTest, $fail) public function printExceptionTrace(\Exception $e) { - static $limit = 10; $class = $e instanceof \PHPUnit_Framework_ExceptionWrapper @@ -431,7 +428,11 @@ public function printScenarioTrace(ScenarioDriven $failedTest) foreach ($trace as $step) { - $message = $this->message($i)->prepend(' ')->width(strlen($length))->append(". ".$step->getPhpCode()); + $message = $this + ->message($i) + ->prepend(' ') + ->width(strlen($length)) + ->append(". " . $step->getPhpCode()); if ($step->hasFailed()) { $message->append('')->style('bold'); @@ -467,7 +468,7 @@ protected function buildResultsTable(SuiteEvent $e) } if ($test instanceof \PHPUnit_Framework_TestSuite_DataProvider) { $test = $test->testAt(0); - $output_length = $test instanceof \Codeception\TestCase + $output_length = $test instanceof TestCase ? strlen($test->getFeature()) + strlen($test->getFileName()) : $test->toString(); @@ -481,9 +482,9 @@ protected function buildResultsTable(SuiteEvent $e) } $cols = $this->columns[0]; if ((strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') - and (php_sapi_name() == "cli") - and (getenv('TERM')) - and (getenv('TERM') != 'unknown') + && (php_sapi_name() == "cli") + && (getenv('TERM')) + && (getenv('TERM') != 'unknown') ) { $cols = intval(`command -v tput >> /dev/null 2>&1 && tput cols`); } @@ -500,33 +501,41 @@ protected function buildResultsTable(SuiteEvent $e) protected function getTestMessage(\PHPUnit_Framework_TestCase $test, $inProgress = false) { if (!$test instanceof TestCase) { - return $this->message = $this->message('%s::%s') + $this->message = $this + ->message('%s::%s') ->with(get_class($test), $test->getName(true)) ->apply(function ($str) { return str_replace('with data set', "|", $str); } ) ->cut($inProgress ? $this->columns[0]+$this->columns[1] - 15 : $this->columns[0]-1) ->style('focus') ->prepend($inProgress ? 'Running ' : ''); + return $this->message; } $filename = $test->getSignature(); $feature = $test->getFeature(); if ($feature) { - return $this->message = $this->message($inProgress ? $feature : ucfirst($feature)) + $this->message = $this + ->message($inProgress ? $feature : ucfirst($feature)) ->apply(function ($str) { return str_replace('with data set', "|", $str); } ) ->cut($inProgress ? $this->columns[0]+$this->columns[1] - 17 - strlen($filename): $this->columns[0]- 4 - strlen($filename)) ->style('focus') ->prepend($inProgress ? 'Trying to ' : '') ->append(" ($filename)"); + return $this->message; } - return $this->message = $this->message("%s ") + + $this->message = $this + ->message("%s ") ->prepend($inProgress ? 'Running ' : '') ->with($filename); + return $this->message; } protected function writeCurrentTest(\PHPUnit_Framework_TestCase $test) { - if (!$this->isDetailed($test) and $this->output->isInteractive()) { - $this->getTestMessage($test, true) + if (!$this->isDetailed($test) && $this->output->isInteractive()) { + $this + ->getTestMessage($test, true) ->append('... ') ->write(); return; @@ -562,5 +571,4 @@ protected function writeFinishedTest(\PHPUnit_Framework_TestCase $test) ->write(); } } - } diff --git a/src/Codeception/Subscriber/ErrorHandler.php b/src/Codeception/Subscriber/ErrorHandler.php index 8b8af5ebae..bdf60c2a6c 100644 --- a/src/Codeception/Subscriber/ErrorHandler.php +++ b/src/Codeception/Subscriber/ErrorHandler.php @@ -1,5 +1,4 @@ getResult()->stopOnError(true); $e->getResult()->stopOnFailure(true); } - -} \ No newline at end of file +} diff --git a/src/Codeception/Subscriber/GracefulTermination.php b/src/Codeception/Subscriber/GracefulTermination.php index 0589a0bb80..5c00f14386 100644 --- a/src/Codeception/Subscriber/GracefulTermination.php +++ b/src/Codeception/Subscriber/GracefulTermination.php @@ -1,11 +1,12 @@ suiteEvent->getResult()->stopOnError(true); $this->suiteEvent->getResult()->stopOnFailure(true); } - throw new \RuntimeException("\n\n---------------------------\nTESTS EXECUTION TERMINATED\n---------------------------\n"); + throw new \RuntimeException( + "\n\n---------------------------\nTESTS EXECUTION TERMINATED\n---------------------------\n" + ); } public static function getSubscribedEvents() @@ -42,5 +45,4 @@ public static function getSubscribedEvents() } return [Events::SUITE_BEFORE => 'handleSuite']; } - -} \ No newline at end of file +} diff --git a/src/Codeception/Subscriber/Module.php b/src/Codeception/Subscriber/Module.php index 9bfb10864a..4d698e6dc1 100644 --- a/src/Codeception/Subscriber/Module.php +++ b/src/Codeception/Subscriber/Module.php @@ -92,5 +92,4 @@ public function afterStep(StepEvent $e) $module->_afterStep($e->getStep(), $e->getTest()); } } - } diff --git a/src/Codeception/Subscriber/Shared/StaticEvents.php b/src/Codeception/Subscriber/Shared/StaticEvents.php index 30d9af2a72..b559c00a3a 100644 --- a/src/Codeception/Subscriber/Shared/StaticEvents.php +++ b/src/Codeception/Subscriber/Shared/StaticEvents.php @@ -3,10 +3,8 @@ trait StaticEvents { - static function getSubscribedEvents() { return static::$events; } - } \ No newline at end of file diff --git a/src/Codeception/TestCase/Cept.php b/src/Codeception/TestCase/Cept.php index e128ed232f..4f1f68ae54 100644 --- a/src/Codeception/TestCase/Cept.php +++ b/src/Codeception/TestCase/Cept.php @@ -1,21 +1,26 @@ basename($this->getFileName(), 'Cept.php'), 'file' => $this->getFileName(), 'feature' => $this->getFeature()]; + return [ + 'name' => basename($this->getFileName(), 'Cept.php'), + 'file' => $this->getFileName(), + 'feature' => $this->getFeature() + ]; } } diff --git a/src/Codeception/TestCase/Cest.php b/src/Codeception/TestCase/Cest.php index 35312dae23..375619ef15 100644 --- a/src/Codeception/TestCase/Cest.php +++ b/src/Codeception/TestCase/Cest.php @@ -1,20 +1,27 @@ testClassInstance->_failed($I); } } - } diff --git a/src/Codeception/TestCase/Interfaces/Configurable.php b/src/Codeception/TestCase/Interfaces/Configurable.php index 4a0784083a..34434330c9 100644 --- a/src/Codeception/TestCase/Interfaces/Configurable.php +++ b/src/Codeception/TestCase/Interfaces/Configurable.php @@ -7,7 +7,6 @@ interface Configurable { - public function configActor($actor); public function configDispatcher(EventDispatcher $dispatcher); @@ -21,5 +20,4 @@ public function config($name, $value); public function configEnv($env); public function initConfig(); - } \ No newline at end of file diff --git a/src/Codeception/TestCase/Interfaces/Plain.php b/src/Codeception/TestCase/Interfaces/Plain.php index 2f240fae38..201fdf944a 100644 --- a/src/Codeception/TestCase/Interfaces/Plain.php +++ b/src/Codeception/TestCase/Interfaces/Plain.php @@ -6,4 +6,4 @@ */ interface Plain { -} \ No newline at end of file +} diff --git a/src/Codeception/TestCase/Interfaces/Reported.php b/src/Codeception/TestCase/Interfaces/Reported.php index 47902799d7..c64023a418 100644 --- a/src/Codeception/TestCase/Interfaces/Reported.php +++ b/src/Codeception/TestCase/Interfaces/Reported.php @@ -3,10 +3,8 @@ interface Reported { - /** * @return array */ public function getReportFields(); - -} \ No newline at end of file +} diff --git a/src/Codeception/TestCase/Interfaces/ScenarioDriven.php b/src/Codeception/TestCase/Interfaces/ScenarioDriven.php index 84354b83d3..c4534d8748 100644 --- a/src/Codeception/TestCase/Interfaces/ScenarioDriven.php +++ b/src/Codeception/TestCase/Interfaces/ScenarioDriven.php @@ -3,7 +3,6 @@ interface ScenarioDriven { - public function getFeature(); /** @@ -14,4 +13,4 @@ public function getScenario(); public function getScenarioText($format = 'text'); public function preload(); -} \ No newline at end of file +} diff --git a/src/Codeception/TestCase/Shared/Actor.php b/src/Codeception/TestCase/Shared/Actor.php index 7b46117564..e8d97f555d 100644 --- a/src/Codeception/TestCase/Shared/Actor.php +++ b/src/Codeception/TestCase/Shared/Actor.php @@ -4,7 +4,7 @@ use Codeception\Event\StepEvent; use Codeception\Events; use Codeception\Exception\ConditionalAssertionFailed; -use Codeception\Exception\ConfigurationException as ConfigurationException; +use Codeception\Exception\ConfigurationException; use Codeception\Lib\Di; use Codeception\Lib\ModuleContainer; use Codeception\Lib\Parser; @@ -13,7 +13,6 @@ use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcher; - trait Actor { /** @@ -161,5 +160,4 @@ public function config($property, $value) $this->$property = $value; return $this; } - -} \ No newline at end of file +} diff --git a/src/Codeception/TestCase/Shared/Configuration.php b/src/Codeception/TestCase/Shared/Configuration.php index b91b0da127..a48d8639aa 100644 --- a/src/Codeception/TestCase/Shared/Configuration.php +++ b/src/Codeception/TestCase/Shared/Configuration.php @@ -1,8 +1,7 @@ $property = $value; return $this; } - -} \ No newline at end of file +} diff --git a/src/Codeception/TestCase/Shared/Dependencies.php b/src/Codeception/TestCase/Shared/Dependencies.php index af190fd90e..f6d55ed234 100644 --- a/src/Codeception/TestCase/Shared/Dependencies.php +++ b/src/Codeception/TestCase/Shared/Dependencies.php @@ -1,6 +1,8 @@ getTestResultObject()->passed(); $passedKeys = array_map( function ($testname) { - if ($this instanceof \Codeception\TestCase\Cest) { - $testname = str_replace('Codeception\TestCase\Cest::', get_class($this->getTestClass()) . '::', $testname); + if ($this instanceof Cest) { + $testname = str_replace( + 'Codeception\TestCase\Cest::', + get_class($this->getTestClass()) . '::', + $testname + ); } return preg_replace('~with data set (.*?)~', '', $testname); }, array_keys($passed) @@ -30,7 +36,11 @@ function ($testname) { } if (!in_array($dependency, $passedKeys)) { - $this->getTestResultObject()->addError($this, new \PHPUnit_Framework_SkippedTestError(sprintf("This test depends on '$dependency' to pass.")), 0); + $this->getTestResultObject()->addError( + $this, + new \PHPUnit_Framework_SkippedTestError(sprintf("This test depends on '$dependency' to pass.")), + 0 + ); return false; } @@ -49,6 +59,4 @@ public function setDependencies(array $dependencies) { $this->dependencies = $dependencies; } - - -} \ No newline at end of file +} diff --git a/src/Codeception/TestCase/Shared/ScenarioPrint.php b/src/Codeception/TestCase/Shared/ScenarioPrint.php index a680b0356a..39d1f5cd58 100644 --- a/src/Codeception/TestCase/Shared/ScenarioPrint.php +++ b/src/Codeception/TestCase/Shared/ScenarioPrint.php @@ -15,5 +15,4 @@ public function getScenarioText($format = 'text') } abstract function getRawBody(); - -} \ No newline at end of file +} diff --git a/src/Codeception/TestCase/Test.php b/src/Codeception/TestCase/Test.php index 166d27745c..a122e210ce 100644 --- a/src/Codeception/TestCase/Test.php +++ b/src/Codeception/TestCase/Test.php @@ -1,20 +1,24 @@ val) or ($this->val instanceof \ArrayAccess)) { + if (is_array($this->val) || ($this->val instanceof \ArrayAccess)) { return isset($this->val[$offset]); } return false; @@ -118,7 +118,7 @@ public function offsetExists($offset) public function offsetGet($offset) { - if (is_array($this->val) or ($this->val instanceof \ArrayAccess)) { + if (is_array($this->val) || ($this->val instanceof \ArrayAccess)) { return $this->val[$offset]; } return new Maybe(); @@ -126,14 +126,14 @@ public function offsetGet($offset) public function offsetSet($offset, $value) { - if (is_array($this->val) or ($this->val instanceof \ArrayAccess)) { + if (is_array($this->val) || ($this->val instanceof \ArrayAccess)) { $this->val[$offset] = $value; } } public function offsetUnset($offset) { - if (is_array($this->val) or ($this->val instanceof \ArrayAccess)) { + if (is_array($this->val) || ($this->val instanceof \ArrayAccess)) { unset($this->val[$offset]); } } diff --git a/src/Codeception/Util/Shared/Asserts.php b/src/Codeception/Util/Shared/Asserts.php index e10b7f828a..b2db17acef 100644 --- a/src/Codeception/Util/Shared/Asserts.php +++ b/src/Codeception/Util/Shared/Asserts.php @@ -289,6 +289,4 @@ protected function fail($message) { \PHPUnit_Framework_Assert::fail($message); } - - } diff --git a/src/Codeception/Util/Shared/Namespaces.php b/src/Codeception/Util/Shared/Namespaces.php index 2a552ba6e7..8bfe7297f3 100644 --- a/src/Codeception/Util/Shared/Namespaces.php +++ b/src/Codeception/Util/Shared/Namespaces.php @@ -44,5 +44,4 @@ protected function getNamespaces($class) $namespaces = array_filter($namespaces, 'strlen'); return $namespaces; } - -} \ No newline at end of file +} diff --git a/src/Codeception/Util/Soap.php b/src/Codeception/Util/Soap.php index 5623059a8e..3d13e9f21e 100644 --- a/src/Codeception/Util/Soap.php +++ b/src/Codeception/Util/Soap.php @@ -1,5 +1,4 @@ * ``` * - * @param $class - A class to be mocked + * @param mixed $class - A class to be mocked * @param array $params - properties and methods to set * @param bool|\PHPUnit_Framework_TestCase $testCase * @@ -82,7 +81,7 @@ private static function markAsMock($mock, \ReflectionClass $reflection) /** * Creates $num instances of class through `Stub::make`. * - * @param $class + * @param mixed $class * @param int $num * @param array $params * @@ -128,8 +127,8 @@ public static function factory($class, $num = 1, $params = []) * ?> * ``` * - * @param $class - * @param $method + * @param mixed $class + * @param string $method * @param array $params * @param bool|\PHPUnit_Framework_TestCase $testCase * @@ -200,7 +199,7 @@ function ($m) { * ?> * ``` * - * @param $class + * @param mixed $class * @param array $params * @param bool|\PHPUnit_Framework_TestCase $testCase * @@ -270,7 +269,7 @@ public static function copy($obj, $params = []) * ?> * ``` * - * @param $class + * @param mixed $class * @param array $constructorParams * @param array $params * @param bool|\PHPUnit_Framework_TestCase $testCase @@ -321,7 +320,7 @@ public static function construct($class, $constructorParams = [], $params = [], * ?> * ``` * - * @param $class + * @param mixed $class * @param array $constructorParams * @param array $params * @param bool|\PHPUnit_Framework_TestCase $testCase @@ -376,8 +375,8 @@ function ($i) { * ?> * ``` * - * @param $class - * @param $method + * @param mixed $class + * @param string $method * @param array $constructorParams * @param array $params * @param bool|\PHPUnit_Framework_TestCase $testCase diff --git a/src/Codeception/Util/Template.php b/src/Codeception/Util/Template.php index 1d292b74ce..4a4a08fd5b 100644 --- a/src/Codeception/Util/Template.php +++ b/src/Codeception/Util/Template.php @@ -45,6 +45,4 @@ public function produce() } return $result; } - - -} \ No newline at end of file +} diff --git a/src/Codeception/Util/Xml.php b/src/Codeception/Util/Xml.php index a29119e956..04fcd86d40 100644 --- a/src/Codeception/Util/Xml.php +++ b/src/Codeception/Util/Xml.php @@ -60,4 +60,4 @@ public static function build() { return new XmlBuilder(); } -} \ No newline at end of file +} diff --git a/src/Codeception/Util/XmlStructure.php b/src/Codeception/Util/XmlStructure.php index e18de4f021..4346ba7dd4 100644 --- a/src/Codeception/Util/XmlStructure.php +++ b/src/Codeception/Util/XmlStructure.php @@ -89,6 +89,4 @@ protected function matchForNode($schema, $xml) } return true; } - - -} \ No newline at end of file +}