public static function setUpBeforeClass() { /** * @var $session Session */ $session = \common\classes\Application::get_class(Session::class); self::$session_id = $session->get_id(); }
public function getConnection() { if ($this->conn === null) { $dsn = 'mysql:dbname=' . $_SERVER['PM_UNIT_DB_NAME'] . ';host=' . $_SERVER['PM_UNIT_DB_HOST']; if (self::$pdo == null) { self::$pdo = new PDO($dsn, $_SERVER['PM_UNIT_DB_USER'], $_SERVER['PM_UNIT_DB_PASS']); } $this->conn = $this->createDefaultDBConnection(self::$pdo, $_SERVER['PM_UNIT_DB_NAME']); } return $this->conn; }
public function setUp() { if (class_exists('vfsStream', false) === false) { $this->markTestSkipped('vfsStream not installed.'); } vfsStreamWrapper::register(); $root = vfsStream::newDirectory('home/config'); $root->getChild('config')->addChild(vfsStream::newFile('crypto.php')->withContent(' <?php $config_auth["keyphrase"] = "moo"; $config_auth["base_salt"] = "baa"; ?> ')); vfsStreamWrapper::setRoot($root); self::$slc = $this->getMock('\\Core\\Session\\LocalStorage', array('get', 'set', 'destroy')); self::$srp = $this->getMock('\\Core\\Session\\RemoteStorage', array('set_remote_addr', '__set', '__get', 'save', 'add', 'load', 'destroy')); self::$sh = new \Core\Session\Handler(); self::$sh->set_remote_addr(TEST_IP)->attach_local_storage(self::$slc)->attach_remote_storage(self::$srp)->initialize_remote_storage()->attach_crypto_config('vfs://config/crypto.php'); }
/** * This method is called before the first test of this test class is run. * * @since Method available since Release 3.4.0 */ public static function setUpBeforeClass() { self::$config = json_decode(file_get_contents(dirname(__DIR__) . '/config.test.json'), true); }
// Remove the following line when you complete this test. throw new PHPUnit2_Framework_IncompleteTestError(); } /** * @todo Implement testIsset_var() */ public function testIsset_var() { // Remove the following line when you complete this test. throw new PHPUnit2_Framework_IncompleteTestError(); } /** * @todo Implement testIsset_flash() */ public function testIsset_flash() { // Remove the following line when you complete this test. throw new PHPUnit2_Framework_IncompleteTestError(); } } // Call SessionTest::main() if this source file is executed directly. if (PHPUnit2_MAIN_METHOD == "SessionTest::main") { SessionTest::main(); } // -- set Emacs parameters -- // Local variables: // tab-width: 4 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End:
<?php // NOTE: // to run these tests, download simpletest (http://www.simpletest.org/) // and place it outside (but at the same level) of the kirby directory. // require_once dirname(__FILE__) . '/../../simpletest/unit_tester.php'; require_once dirname(__FILE__) . '/../../simpletest/reporter.php'; require_once 'session.php'; require_once 'string.php'; require_once 'array.php'; $test = new SessionTest(); $test->run(new HtmlReporter()); $test = new StringTest(); $test->run(new HtmlReporter()); $test = new ArrayTest(); $test->run(new HtmlReporter());