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