Author: Andres Gutierrez (andres@phalconphp.com)
Author: Nikolaos Dimopoulos (nikos@phalconphp.com)
Inheritance: extends Codeception\Test\Unit, use trait Codeception\Specify
Esempio n. 1
0
 protected function _before()
 {
     parent::_before();
     /** @var \Phalcon\Mvc\Application $app */
     $app = $this->tester->getApplication();
     $this->di = $app->getDI();
 }
Esempio n. 2
0
 protected function _before()
 {
     parent::_before();
     /** @var \Phalcon\Mvc\Application $app */
     $app = $this->tester->getApplication();
     $this->modelsManager = $app->getDI()->getShared('modelsManager');
 }
Esempio n. 3
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     if (!class_exists('imagick')) {
         $this->markTestSkipped('Warning: imagick extension is not loaded');
     }
 }
Esempio n. 4
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     if (!function_exists('gd_info')) {
         $this->markTestSkipped('Warning: gd extension is not loaded');
     }
 }
Esempio n. 5
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     if (!extension_loaded('redis')) {
         $this->markTestSkipped('Warning: redis extension is not loaded');
     }
 }
Esempio n. 6
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     if (!extension_loaded('memcache')) {
         $this->markTestSkipped('Warning: memcache extension is not loaded');
     }
 }
Esempio n. 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');
 }
Esempio n. 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';
 }
Esempio n. 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';
 }
Esempio n. 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();
 }
Esempio n. 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);
     }
 }
Esempio n. 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);
 }
Esempio n. 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);
 }
Esempio n. 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());
     }
 }
Esempio n. 15
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     $this->logPath = PATH_OUTPUT . 'tests/logs/';
 }
Esempio n. 16
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     require_once PATH_DATA . 'di/SomeService.php';
 }
Esempio n. 17
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     Route::reset();
 }
Esempio n. 18
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     require_once PATH_DATA . 'annotations/TestClass.php';
 }
Esempio n. 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']);
 }
Esempio n. 20
0
 /**
  * executed before each test
  */
 protected function _before()
 {
     parent::_before();
     $this->setupMongo($this->tester);
 }
Esempio n. 21
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     $this->config = ['ru' => ['Hello!' => 'Привет!', 'Hello %s %s %s!' => 'Привет, %s %s %s!']];
 }
Esempio n. 22
0
 /**
  * executed before each test
  */
 public function _before()
 {
     parent::_before();
     $this->config = ['ru' => ['content' => PATH_DATA . 'translation/csv/ru_RU.csv']];
 }
Esempio n. 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]);
 }
Esempio n. 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]);
 }