public function testHaveAndSeeInDatabase() { $this->module->haveInDatabase('users', array('name' => 'john')); $this->module->seeInDatabase('users', array('name' => 'john')); $this->module->_before(\Codeception\Util\Stub::make('\\Codeception\\TestCase')); $this->module->dontSeeInDatabase('users', array('name' => 'john')); }
public function testHaveAndSeeInDatabase() { $user_id = $this->module->haveInDatabase('users', array('name' => 'john', 'email' => '*****@*****.**')); $this->assertInternalType('integer', $user_id); $this->module->seeInDatabase('users', array('name' => 'john', 'email' => '*****@*****.**')); $this->module->_after(\Codeception\Util\Stub::make('\Codeception\TestCase')); $this->module->dontSeeInDatabase('users', array('name' => 'john')); }
public function testReconnectOption() { $testCase1 = \Codeception\Util\Stub::make('\\Codeception\\TestCase'); $testCase2 = \Codeception\Util\Stub::make('\\Codeception\\TestCase'); self::$module->_reconfigure(['reconnect' => true]); $this->assertNotNull(self::$module->driver, 'driver is null before test'); $this->assertNotNull(self::$module->dbh, 'dbh is null before test'); self::$module->_after($testCase1); $this->assertNull(self::$module->driver, 'driver is not unset by _after'); $this->assertNull(self::$module->dbh, 'dbh is not unset by _after'); self::$module->_before($testCase2); $this->assertNotNull(self::$module->driver, 'driver is not set by _before'); $this->assertNotNull(self::$module->dbh, 'dbh is not set by _before'); self::$module->_reconfigure(['reconnect' => false]); }
/** * @param \Codeception\Lib\ModuleContainer $moduleContainer * @param null $config */ public function __construct(ModuleContainer $moduleContainer, $config) { $propelConfig = Config::get(PropelConstants::PROPEL); $defaultConfig = $propelConfig['database']['connections']['default']; $config += ['dsn' => $defaultConfig['dsn'], 'user' => Config::get(PropelConstants::ZED_DB_USERNAME), 'password' => Config::get(PropelConstants::ZED_DB_PASSWORD)]; parent::__construct($moduleContainer, $config); }
public function testHaveAndSeeInDatabase() { self::$module->_before(\Codeception\Util\Stub::make('\\Codeception\\TestCase')); $user_id = self::$module->haveInDatabase('users', array('name' => 'john', 'email' => '*****@*****.**')); $group_id = self::$module->haveInDatabase('groups', array('name' => 'john', 'enabled' => false)); $this->assertInternalType('integer', $user_id); self::$module->seeInDatabase('users', array('name' => 'john', 'email' => '*****@*****.**')); self::$module->dontSeeInDatabase('users', array('name' => 'john', 'email' => null)); self::$module->_after(\Codeception\Util\Stub::make('\\Codeception\\TestCase')); self::$module->dontSeeInDatabase('users', array('name' => 'john')); }
public function _initialize() { //make sure we initialize all of the settings parent::_initialize(); }