コード例 #1
0
 public function testDeprecationMessagesRespectErrorLevelSetting()
 {
     $errorHandler = new ErrorHandler();
     $suiteEvent = new SuiteEvent(new Suite(), null, ['error_level' => 'E_ERROR']);
     $errorHandler->handle($suiteEvent);
     Notification::all();
     //clear the messages
     $errorHandler->errorHandler(E_USER_DEPRECATED, 'deprecated message', __FILE__, __LINE__, []);
     $this->assertEquals([], Notification::all(), 'Deprecation message was added to notifications');
 }
コード例 #2
0
ファイル: Parser.php プロジェクト: nsgomez/Codeception
 public function parseScenarioOptions($code)
 {
     $comments = $this->matchComments($code);
     $this->attachMetadata($comments);
     // deprecated - parsing $scenario->xxx calls
     $metaData = ['group', 'env'];
     $phpCode = $this->stripComments($code);
     $scenario = $this->scenario;
     $feature = $scenario->getFeature();
     foreach ($metaData as $call) {
         $res = preg_match_all("~\\\$scenario->{$call}.*?;~", $phpCode, $matches);
         if (!$res) {
             continue;
         }
         foreach ($matches[0] as $line) {
             // run $scenario->group or $scenario->env
             \Codeception\Lib\Notification::deprecate("\$scenario->{$call}() is deprecated in favor of annotation: // @{$call}", $this->scenario->getFeature());
             eval($line);
         }
     }
 }
コード例 #3
0
 public function afterSuite(SuiteEvent $e)
 {
     $this->message()->width($this->width, '-')->writeln();
     $deprecationMessages = Notification::all();
     foreach ($deprecationMessages as $message) {
         $this->output->notification($message);
     }
 }
コード例 #4
0
 protected function checkEnvironmentExists(TestInterface $test)
 {
     $envs = $test->getMetadata()->getEnv();
     if (empty($envs)) {
         return;
     }
     if (!isset($this->settings['env'])) {
         Notification::warning("Environments are not configured", Descriptor::getTestFullName($test));
         return;
     }
     $availableEnvironments = array_keys($this->settings['env']);
     $listedEnvironments = explode(',', implode(',', $envs));
     foreach ($listedEnvironments as $env) {
         if (!in_array($env, $availableEnvironments)) {
             Notification::warning("Environment {$env} was not configured but used in test", Descriptor::getTestFullName($test));
         }
     }
 }
コード例 #5
0
 public function __call($method, $args)
 {
     // all methods were deprecated and removed from here
     Notification::deprecate("\$scenario->{$method}() was deprecated in 2.1 and removed. Don't use it");
 }
コード例 #6
0
ファイル: Dbh.php プロジェクト: foxman209/Codeception
 public function _initialize()
 {
     Notification::deprecate("Module Dbh is deprecated and will be removed in 2.2");
 }
コード例 #7
0
 private function handleDeprecationError($type, $message, $file, $line, $context)
 {
     if (!($this->errorLevel & $type)) {
         return;
     }
     if ($this->deprecationsInstalled && $this->oldHandler) {
         call_user_func($this->oldHandler, $type, $message, $file, $line, $context);
         return;
     }
     Notification::deprecate("{$message}", "{$file}:{$line}");
 }
コード例 #8
0
ファイル: Scenario.php プロジェクト: vladislavl-hyuna/crmapp
 public function running()
 {
     \Codeception\Lib\Notification::deprecate("Scenario is always running. Please remove \$scenario->running() call.", $this->getFeature());
     return true;
 }
コード例 #9
0
ファイル: Yii2.php プロジェクト: solutionDrive/Codeception
 private function defineConstants()
 {
     defined('YII_DEBUG') or define('YII_DEBUG', true);
     defined('YII_ENV') or define('YII_ENV', 'test');
     defined('YII_ENABLE_ERROR_HANDLER') or define('YII_ENABLE_ERROR_HANDLER', false);
     if (YII_ENV !== 'test') {
         Notification::warning("YII_ENV is not set to `test`, please add \n\n`define(\\'YII_ENV\\', \\'test\\');`\n\nto bootstrap file", 'Yii Framework');
     }
 }
コード例 #10
0
ファイル: Console.php プロジェクト: solutionDrive/Codeception
 public function afterSuite(SuiteEvent $e)
 {
     $this->message()->width($this->width, '-')->writeln();
     $messages = Notification::all();
     foreach (array_count_values($messages) as $message => $count) {
         if ($count > 1) {
             $message = $count . 'x ' . $message;
         }
         $this->output->notification($message);
     }
 }