Example #1
0
 /**
  * Creates a predefined environment using the default environment
  *
  * Extending classes that have their own setUp() should call
  * parent::setUp()
  */
 public function setUp()
 {
     if (self::$_assert_type_compatability === NULL) {
         self::$_assert_type_compatability = version_compare(PHPUnit_Runner_Version::id(), '3.5.0', '<=');
     }
     $this->_helpers = new Kohana_Unittest_Helpers();
     $this->setEnvironment($this->environmentDefault);
 }
 public function setUp()
 {
     parent::setUp();
     $this->config = $this->getMockBuilder('LogReader_Config')->setConstructorArgs(array(array()))->getMock();
     $this->config->expects($this->any())->method('get_store')->will($this->returnValue(array('type' => 'File', 'path' => APPPATH . 'logs')));
     $this->store = $this->getMockBuilder('LogReader_Store')->setConstructorArgs(array($this->config->get_store()))->getMockForAbstractClass();
     $this->logreader = new LogReader($this->config, $this->store);
 }
Example #3
0
 /**
  * Creates a predefined environment using the default environment
  *
  * Extending classes that have their own setUp() should call
  * parent::setUp()
  */
 public function setUp()
 {
     if (self::$_assert_type_compatability === NULL) {
         if (!class_exists('PHPUnit_Runner_Version')) {
             require_once 'PHPUnit/Runner/Version.php';
         }
         self::$_assert_type_compatability = version_compare(PHPUnit_Runner_Version::id(), '3.5.0', '<=');
     }
     $this->_helpers = new Unittest_Helpers();
     $this->setEnvironment($this->environmentDefault);
 }
Example #4
0
 /**
  * Setup the enviroment for each test
  *
  * PHPUnit automatically backups up & restores global variables
  */
 public function setUp()
 {
     parent::setUp();
     $_SERVER['argv'] = array('index.php');
     foreach ($this->options as $option => $value) {
         if (is_string($option)) {
             $_SERVER['argv'][] = $option . '=' . $value;
         } else {
             $_SERVER['argv'][] = $value;
         }
     }
     $_SERVER['argc'] = count($_SERVER['argv']);
 }
    /**
     * Insert some tables with data into the database
     */
    public static function setUpBeforeClass()
    {
        parent::setUpBeforeClass();
        $queries = array('DROP TABLE IF EXISTS `test_stats`;', 'CREATE TABLE `test_stats` (
				`id` INT PRIMARY KEY AUTO_INCREMENT,
				`lifetime` INT,
				`period` INT,
				`data` VARCHAR(256)
			)', "INSERT INTO `test_stats` VALUES\n\t\t\t\t(1, 50, 10, '0,0,1,2,3,4,0'),\n\t\t\t\t(2, 24,  7, '1,1,1,1,1,1,1'),\n\t\t\t\t(3,  2,  0, '0,0,0,0,0,0,0'),\n\t\t\t\t(4, 19, 17, '4,2,1,5,0,3,2')");
        $db = Database::instance();
        $db->connect();
        foreach ($queries as $query) {
            $result = mysql_query($query);
            if ($result === FALSE) {
                throw new Exception(mysql_error());
            }
        }
    }
Example #6
0
 /**
  * Sets up the test enviroment
  */
 public function setUp()
 {
     parent::setUp();
     Text::alternate();
 }
Example #7
0
 public function setUp()
 {
     parent::setUp();
     $this->config = new LogReader_Config(array('limit' => 40, 'auto_refresh_interval' => 5, 'store' => array('type' => 'File', 'path' => APPPATH . 'logs'), 'route' => 'logreader', 'static_route' => 'logreader/media', 'tester' => FALSE, 'authentication' => TRUE, 'users' => array(array('username' => 'admin', 'password' => '123456'))));
 }
Example #8
0
 /**
  * Removes cache files created during tests
  */
 public function tearDown()
 {
     parent::tearDown();
     $this->clean_cache_dir();
 }
Example #9
0
 /**
  * Tear down environment
  */
 public function tearDown()
 {
     parent::tearDown();
     setlocale(LC_ALL, $this->default_locale);
 }
Example #10
0
 /**
  * Restores original timezone after testing.
  */
 public function tearDown()
 {
     date_default_timezone_set($this->_original_timezone);
     parent::tearDown();
 }
Example #11
0
 /**
  * Removes cache files created during tests
  */
 public function tearDown()
 {
     parent::tearDown();
     $this->cleanCacheDir();
 }
Example #12
0
 public function setUp()
 {
     parent::setUp();
     $this->_nav_simple = self::_get_test_config();
     $this->_menu = $this->_build_test_menu();
 }
Example #13
0
 public function setUp()
 {
     parent::setUp();
     $this->store = new LogReader_Store_File(array('type' => 'File', 'path' => realpath(__DIR__ . '/../../../test_data/logs')));
 }
Example #14
0
 public function setUp()
 {
     parent::setUp();
     $this->setEnvironment(array('Kohana::$base_url' => 'http://example.com/'));
 }