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 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 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]); }