/** * Hooks function. * * This function is used to avoid loading any unnecessary functions/code. * * @see admin_menu, wp_ajax actions */ public function hooks() { $connection = new ConnectionTest(); $this->definitions = $this->plugin->get_definitions(); $this->connected = $connection->test(); add_action('admin_menu', array($this, 'add_menu_item')); add_filter('plugin_action_links_' . $this->definitions->basename, array($this, 'add_settings_link')); add_action('admin_notices', array($this, 'internet_connected_admin_notice')); }
/** * Set up a new object * * @return null */ public function setUp() { $user = getenv("PDOOCI_user"); $pwd = getenv("PDOOCI_pwd"); $str = getenv("PDOOCI_str"); self::$con = new PDOOCI\PDO($str, $user, $pwd); }
private function checkMysqlPDO() { try { $dbh = new \pdo('mysql:host=127.0.0.1:3306;dbname=' . $this->dbname, $this->dbuser, $this->dbpass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); return true; } catch (\PDOException $ex) { return false; } } private function checkRabbitMQ() { $amqpConnection = new AMQPConnection(); $amqpConnection->setHost($this->mqHost); $amqpConnection->setLogin($this->mqUser); $amqpConnection->setPassword($this->mqPass); $amqpConnection->setVhost($this->mqVhost); $amqpConnection->setPort($this->mqPort); $amqpConnection->connect(); return $amqpConnection->isConnected(); } private function checkDiskSpaceOk() { if (disk_free_space($this->diskPath) / disk_total_space($this->diskPath) < $this->diskThreshold) { return false; } return true; } } $test = new ConnectionTest(); $test->run(); // end of script
public function testRollback() { if (self::$testTransactions) { parent::testRollback(); } }