Author: Andres Gutierrez (andres@phalconphp.com)
Author: Nikolaos Dimopoulos (nikos@phalconphp.com)
Inheritance: extends Codeception\Test\Unit, use trait Codeception\Specify
示例#1
0
 protected function _before()
 {
     parent::_before();
     /** @var \Phalcon\Mvc\Application $app */
     $app = $this->tester->getApplication();
     $this->di = $app->getDI();
 }
示例#2
0
 protected function _before()
 {
     parent::_before();
     /** @var \Phalcon\Mvc\Application $app */
     $app = $this->tester->getApplication();
     $this->modelsManager = $app->getDI()->getShared('modelsManager');
 }
示例#3
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     if (!class_exists('imagick')) {
         $this->markTestSkipped('Warning: imagick extension is not loaded');
     }
 }
示例#4
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     if (!function_exists('gd_info')) {
         $this->markTestSkipped('Warning: gd extension is not loaded');
     }
 }
示例#5
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     if (!extension_loaded('redis')) {
         $this->markTestSkipped('Warning: redis extension is not loaded');
     }
 }
示例#6
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     if (!extension_loaded('memcache')) {
         $this->markTestSkipped('Warning: memcache extension is not loaded');
     }
 }
示例#7
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     $this->validation = new Validation();
     $this->validation->add('name', new Validation\Validator\PresenceOf(['message' => 'Name cant be empty.']));
     $this->validation->setFilters('name', 'trim');
 }
示例#8
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     if (!function_exists('xcache_emulation') && !function_exists('xcache_get')) {
         $this->markTestSkipped('Warning: xcache extension is not loaded');
     }
     require_once PATH_DATA . 'annotations/TestClass.php';
     require_once PATH_DATA . 'annotations/TestClassNs.php';
 }
示例#9
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     if (!function_exists('apc_fetch')) {
         $this->markTestSkipped('Warning: apc extension is not loaded');
     }
     require_once PATH_DATA . 'annotations/TestClass.php';
     require_once PATH_DATA . 'annotations/TestClassNs.php';
 }
示例#10
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     require_once PATH_DATA . 'di/InjectableComponent.php';
     require_once PATH_DATA . 'di/SimpleComponent.php';
     require_once PATH_DATA . 'di/SomeComponent.php';
     Di::reset();
     $this->phDi = new Di();
 }
示例#11
0
 /**
  * executed after each test
  */
 protected function _after()
 {
     parent::_after();
     if (PHP_SESSION_ACTIVE == session_status()) {
         session_destroy();
     }
     foreach ($this->sessionConfig as $key => $val) {
         ini_set($key, $val);
     }
 }
示例#12
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     $di = $this->tester->getApplication()->getDI();
     $di->set('modelsManager', function () {
         return new Manager();
     });
     $di->set('modelsMetadata', function () {
         return new Memory();
     });
     Di::setDefault($di);
 }
示例#13
0
 /**
  * executed after each test
  */
 protected function _after()
 {
     parent::_after();
     $loaders = spl_autoload_functions();
     if (is_array($loaders)) {
         foreach ($loaders as $loader) {
             spl_autoload_unregister($loader);
         }
     }
     foreach ($this->loaders as $loader) {
         spl_autoload_register($loader);
     }
     set_include_path($this->includePath);
 }
示例#14
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     if (!extension_loaded('yaml')) {
         $this->markTestSkipped('Warning: yaml extension is not loaded');
     }
     if (!defined('TEST_BT_HOST') || !defined('TEST_BT_PORT')) {
         $this->markTestSkipped('TEST_BT_HOST and/or TEST_BT_PORT env variables are not defined');
     }
     $this->client = new Beanstalk(['host' => TEST_BT_HOST, 'port' => TEST_BT_PORT]);
     try {
         @$this->client->connect();
     } catch (\Exception $e) {
         $this->markTestSkipped($e->getMessage());
     }
 }
示例#15
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     $this->logPath = PATH_OUTPUT . 'tests/logs/';
 }
示例#16
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     require_once PATH_DATA . 'di/SomeService.php';
 }
示例#17
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     Route::reset();
 }
示例#18
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     require_once PATH_DATA . 'annotations/TestClass.php';
 }
示例#19
0
 /**
  * Initialize data for the tests
  */
 protected function _before()
 {
     parent::_before();
     $this->di = $this->tester->getApplication()->getDI();
     $this->robot = new Robots(['name' => 'Robotina', 'type' => 'mechanical', 'year' => 1972, 'datetime' => (new DateTime())->format('Y-m-d H:i:s'), 'deleted' => null, 'text' => 'text']);
     $this->anotherRobot = new Robots(['name' => 'Robotina', 'type' => 'hydraulic', 'year' => 1952, 'datetime' => (new DateTime())->format('Y-m-d H:i:s'), 'deleted' => null, 'text' => 'text']);
     $this->deletedRobot = new Robots(['name' => 'Robotina', 'type' => 'mechanical', 'year' => 1972, 'datetime' => (new DateTime())->format('Y-m-d H:i:s'), 'deleted' => (new DateTime())->format('Y-m-d H:i:s'), 'text' => 'text']);
 }
示例#20
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     $this->setupMongo($this->tester);
 }
示例#21
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     $this->config = ['ru' => ['Hello!' => 'Привет!', 'Hello %s %s %s!' => 'Привет, %s %s %s!']];
 }
示例#22
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     $this->config = ['ru' => ['content' => PATH_DATA . 'translation/csv/ru_RU.csv']];
 }
示例#23
0
 public function _before()
 {
     parent::_before();
     $this->connection = new Mysql(['host' => TEST_DB_MYSQL_HOST, 'username' => TEST_DB_MYSQL_USER, 'password' => TEST_DB_MYSQL_PASSWD, 'dbname' => TEST_DB_MYSQL_NAME, 'port' => TEST_DB_MYSQL_PORT, 'charset' => TEST_DB_MYSQL_CHARSET]);
 }
示例#24
0
 public function _before()
 {
     parent::_before();
     $this->connection = new Postgresql(['host' => TEST_DB_POSTGRESQL_HOST, 'username' => TEST_DB_POSTGRESQL_USER, 'password' => TEST_DB_POSTGRESQL_PASSWD, 'dbname' => TEST_DB_POSTGRESQL_NAME, 'port' => TEST_DB_POSTGRESQL_PORT, 'schema' => TEST_DB_POSTGRESQL_SCHEMA]);
 }