PMA_SeleniumBase::setUp PHP Method

setUp() protected method

Configures the selenium and database link.
protected setUp ( ) : void
return void
    protected function setUp()
    {
        if (!self::$_selenium_enabled) {
            $this->markTestSkipped('Selenium testing not configured.');
        }
        $caps = $this->getDesiredCapabilities();
        $this->setDesiredCapabilities(array_merge($caps, array('name' => get_class($this) . '__' . $this->getName())));
        parent::setUp();
        $this->setBrowserUrl($GLOBALS['TESTSUITE_URL']);
        $this->_mysqli = new mysqli($GLOBALS['TESTSUITE_SERVER'], $GLOBALS['TESTSUITE_USER'], $GLOBALS['TESTSUITE_PASSWORD']);
        if ($this->_mysqli->connect_errno) {
            throw new Exception('Failed to connect to MySQL (' . $this->_mysqli->error . ')');
        }
        $this->database_name = $GLOBALS['TESTSUITE_DATABASE'] . mb_substr(md5(rand()), 0, 7);
        $this->dbQuery('CREATE DATABASE IF NOT EXISTS ' . $this->database_name);
        $this->dbQuery('USE ' . $this->database_name);
    }

Usage Example

 /**
  * Setup the browser environment to run the selenium test case
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->dbQuery("CREATE TABLE `test_table` (" . " `id` int(11) NOT NULL AUTO_INCREMENT," . " `val` int(11) NOT NULL," . " `val2` int(11) NOT NULL," . " PRIMARY KEY (`id`)" . ")");
     $this->dbQuery("INSERT INTO test_table (val) VALUES (22)");
     $this->dbQuery("INSERT INTO test_table (val) VALUES (33)");
 }
All Usage Examples Of PMA_SeleniumBase::setUp