Inheritance: extends BaseTester
 public function createApplication()
 {
     $app = new AppTest();
     $app->register(new UrlGeneratorServiceProvider());
     $app['exception_handler']->disable();
     $app->register(new APIServiceProvider(), array('phpcr_api.repositories_config' => array('repository_test' => array('factory' => 'jackalope.doctrine-dbal', 'parameters' => array('doctrine_dbal.config' => array('driver' => 'pdo_sqlite', 'path' => __DIR__ . '/jackalope.db'), 'credentials.username' => 'admin', 'credentials.password' => 'admin'))), 'phpcr_api.mount_prefix' => '/api'));
     return $app;
 }
Beispiel #2
0
 public static function setUpBeforeClass()
 {
     print "\nStarting a web server...";
     $dirname = dirname(__DIR__);
     exec("cd {$dirname}/public && php -S localhost:8000 > /dev/null 2>&1 & echo \$!", AppTest::$pidArray);
     // Wait while the process starts up
     while (!AppTest::isProcessRunning(AppTest::$pidArray[0])) {
     }
     print "\nStarted\n";
 }
Beispiel #3
0
 static function tearDownAfterClass()
 {
     parent::tearDownAfterClass();
     // restore backed up navigation file
     copy('cache/navigation.json', 'conf/navigation.json');
 }
Beispiel #4
0
 /**
  * Initializes the `$i18n`, `$cache`, `$page`, and `$tpl` objects
  * for use with the controller in testing handlers.
  */
 public static function setUpBeforeClass()
 {
     require_once 'lib/Functions.php';
     require_once 'lib/DB.php';
     error_reporting(E_ALL & ~E_NOTICE);
     if (!defined('ELEFANT_ENV')) {
         define('ELEFANT_ENV', 'config');
     }
     $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en';
     $_SERVER['REQUEST_URI'] = '/';
     global $conf, $i18n, $cache, $page, $tpl;
     // Set up the database connection to be in memory
     $conf = parse_ini_file('conf/config.php', TRUE);
     $conf['Database'] = array('master' => array('driver' => 'sqlite', 'file' => ':memory:'));
     // Initializes PDO connection automatically
     foreach (sql_split(file_get_contents('conf/install_sqlite.sql')) as $sql) {
         if (!DB::execute($sql)) {
             die('SQL failed: ' . $sql);
         }
     }
     // Create default admin and member users
     $date = gmdate('Y-m-d H:i:s');
     DB::execute("insert into `user` (id, email, password, session_id, expires, name, type, signed_up, updated, userdata) values (1, ?, ?, null, ?, 'Admin User', 'admin', ?, ?, ?)", '*****@*****.**', User::encrypt_pass('testing'), $date, $date, $date, json_encode(array()));
     DB::execute("insert into `user` (id, email, password, session_id, expires, name, type, signed_up, updated, userdata) values (2, ?, ?, null, ?, 'Joe Member', 'member', ?, ?, ?)", '*****@*****.**', User::encrypt_pass('testing'), $date, $date, $date, json_encode(array()));
     $i18n = new I18n('lang', array('negotiation_method' => 'http'));
     $page = new Page();
     self::$c = new Controller();
     $tpl = new Template('utf-8', self::$c);
     $cache = Cache::init(array());
     self::$c->template($tpl);
     self::$c->cache($cache);
     self::$c->page($page);
     self::$c->i18n($i18n);
 }
Beispiel #5
0
 public function setUp()
 {
     parent::setUp();
     $this->router = $this->app->router;
     $this->test_router = new Router(array('path' => '/test', 'app' => $this->app));
 }