/** */ public function testCheckDbConfig() { require_once 'Phigrate/Exception/Argument.php'; $dbConfig = 'dsn'; try { $this->object->checkDbConfig($dbConfig); $this->fail('checkDbConfig do not accept string argument!'); } catch (Phigrate_Exception_Argument $ex) { $msg = 'The argument dbConfig must be a array!'; $this->assertEquals($msg, $ex->getMessage()); } $dbConfig = array(); try { $this->object->checkDbConfig($dbConfig); $this->fail('checkDbConfig does not accept empty array!'); } catch (Phigrate_Exception_Argument $ex) { $msg = 'The argument dbConfig must be a array!'; $this->assertEquals($msg, $ex->getMessage()); } $dbConfig = array('not empty'); try { $this->object->checkDbConfig($dbConfig); $this->fail('checkDbConfig expect "database" argument!'); } catch (Phigrate_Exception_Argument $ex) { $msg = 'The argument dbConfig must be contains index "database"'; $this->assertEquals($msg, $ex->getMessage()); } $dbConfig = array('database' => 'test'); try { $this->object->checkDbConfig($dbConfig); $this->fail('checkDbConfig expect "host" argument!'); } catch (Phigrate_Exception_Argument $ex) { $msg = 'The argument dbConfig must be contains ' . 'index "host" or index "socket"'; $this->assertEquals($msg, $ex->getMessage()); } $dbConfig = array('host' => 'localhost', 'database' => 'test'); try { $this->object->checkDbConfig($dbConfig); $this->fail('checkDbConfig wait for the "user" argument!'); } catch (Phigrate_Exception_Argument $ex) { $msg = 'The argument dbConfig must be contains index "user"'; $this->assertEquals($msg, $ex->getMessage()); } $dbConfig = array('host' => 'localhost', 'database' => 'test', 'user' => 'test'); try { $this->object->checkDbConfig($dbConfig); $this->fail('checkDbConfig wait for the "password" argument!'); } catch (Phigrate_Exception_Argument $ex) { $msg = 'The argument dbConfig must be contains index "password"'; $this->assertEquals($msg, $ex->getMessage()); } $dbConfig = array('host' => 'localhost', 'database' => 'test', 'user' => 'test', 'password' => 'test'); $this->assertTrue($this->object->checkDbConfig($dbConfig)); }