테스트 설정 정리

This commit is contained in:
bnu 2015-05-22 16:50:11 +09:00
parent 91497fd77b
commit b1e730d17e
16 changed files with 224 additions and 2388 deletions

View file

@ -1,11 +1,13 @@
<?php //[STAMP] 91974ab12b2894dae8d1464cac50fa5d
<?php //[STAMP] 8e0df11a46642efe1cdbcd6ea0a22ad0
// This class was automatically generated by build task
// You should not change it manually as it will be overwritten on next build
// @codingStandardsIgnoreFile
use Codeception\Module\Db;
use Codeception\Module\PhpBrowser;
use Codeception\Module\DbDropTablesHelper;
use Codeception\Module\installHelper;
/**
@ -26,6 +28,174 @@ use Codeception\Module\installHelper;
class InstallTester extends \Codeception\Actor
{
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Inserts SQL record into database. This record will be erased after the test.
*
* ``` php
* <?php
* $I->haveInDatabase('users', array('name' => 'miles', 'email' => 'miles@davis.com'));
* ?>
* ```
*
* @param $table
* @param array $data
*
* @return integer $id
* @see \Codeception\Module\Db::haveInDatabase()
*/
public function haveInDatabase($table, $data) {
return $this->scenario->runStep(new \Codeception\Step\Action('haveInDatabase', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks if a row with given column values exists.
* Provide table name and column values.
*
* Example:
*
* ``` php
* <?php
* $I->seeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
*
* ```
* Will generate:
*
* ``` sql
* SELECT COUNT(*) FROM `users` WHERE `name` = 'Davert' AND `email` = 'davert@mail.com'
* ```
* Fails if no such user found.
*
* @param $table
* @param array $criteria
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Module\Db::seeInDatabase()
*/
public function canSeeInDatabase($table, $criteria = null) {
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('seeInDatabase', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks if a row with given column values exists.
* Provide table name and column values.
*
* Example:
*
* ``` php
* <?php
* $I->seeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
*
* ```
* Will generate:
*
* ``` sql
* SELECT COUNT(*) FROM `users` WHERE `name` = 'Davert' AND `email` = 'davert@mail.com'
* ```
* Fails if no such user found.
*
* @param $table
* @param array $criteria
* @see \Codeception\Module\Db::seeInDatabase()
*/
public function seeInDatabase($table, $criteria = null) {
return $this->scenario->runStep(new \Codeception\Step\Assertion('seeInDatabase', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Effect is opposite to ->seeInDatabase
*
* Checks if there is no record with such column values in database.
* Provide table name and column values.
*
* Example:
*
* ``` php
* <?php
* $I->dontSeeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
*
* ```
* Will generate:
*
* ``` sql
* SELECT COUNT(*) FROM `users` WHERE `name` = 'Davert' AND `email` = 'davert@mail.com'
* ```
* Fails if such user was found.
*
* @param $table
* @param array $criteria
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Module\Db::dontSeeInDatabase()
*/
public function cantSeeInDatabase($table, $criteria = null) {
return $this->scenario->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInDatabase', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Effect is opposite to ->seeInDatabase
*
* Checks if there is no record with such column values in database.
* Provide table name and column values.
*
* Example:
*
* ``` php
* <?php
* $I->dontSeeInDatabase('users', array('name' => 'Davert', 'email' => 'davert@mail.com'));
*
* ```
* Will generate:
*
* ``` sql
* SELECT COUNT(*) FROM `users` WHERE `name` = 'Davert' AND `email` = 'davert@mail.com'
* ```
* Fails if such user was found.
*
* @param $table
* @param array $criteria
* @see \Codeception\Module\Db::dontSeeInDatabase()
*/
public function dontSeeInDatabase($table, $criteria = null) {
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInDatabase', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Fetches a single column value from a database.
* Provide table name, desired column and criteria.
*
* Example:
*
* ``` php
* <?php
* $mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert'));
*
* ```
*
* @version 1.1
*
* @param $table
* @param $column
* @param array $criteria
*
* @return mixed
* @see \Codeception\Module\Db::grabFromDatabase()
*/
public function grabFromDatabase($table, $column, $criteria = null) {
return $this->scenario->runStep(new \Codeception\Step\Action('grabFromDatabase', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@ -1915,4 +2085,15 @@ class InstallTester extends \Codeception\Actor
public function dontSeeInTitle($title) {
return $this->scenario->runStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
*
* @see \Codeception\Module\DbDropTablesHelper::cleanup()
*/
public function cleanup() {
return $this->scenario->runStep(new \Codeception\Step\Action('cleanup', func_get_args()));
}
}

View file

@ -1,5 +1,2 @@
<?php
// Here you can initialize variables that will be available to your tests
\Codeception\Util\Autoload::registerSuffix('Steps', __DIR__.DIRECTORY_SEPARATOR.'_steps');
\Codeception\Util\Autoload::registerSuffix('Page', __DIR__.DIRECTORY_SEPARATOR.'_pages');

View file

@ -1,41 +0,0 @@
<?php
class installPage
{
// include url of current page
public static $URL = '';
/**
* Declare UI map for this page here. CSS or XPath allowed.
* public static $usernameField = '#username';
* public static $formSubmitButton = "#mainForm input[type=submit]";
*/
/**
* Basic route example for your current URL
* You can append any additional parameter to URL
* and use it in tests like: EditPage::route('/123-post');
*/
public static function route($param)
{
return static::$URL.$param;
}
/**
* @var InstallTester;
*/
protected $installTester;
public function __construct(InstallTester $I)
{
$this->installTester = $I;
}
/**
* @return installPage
*/
public static function of(InstallTester $I)
{
return new static($I);
}
}

View file

@ -1,18 +0,0 @@
<?php
namespace InstallTester;
class AdminSteps extends \InstallTester
{
public function login()
{
$I = $this;
}
public function adminLogin()
{
$I = $this;
}
public function logout()
{
$I = $this;
}
}

View file

@ -3,13 +3,13 @@ use \Codeception\Configuration;
$I = new InstallTester($scenario);
$config = (!$this->env) ? Configuration::config() : Configuration::suiteEnvironments('install')[$this->env];
$config = (!$this->env) ? Configuration::suiteSettings('Install', Configuration::config()) : Configuration::suiteEnvironments('Install')[$this->env];
$db_config = $config['modules']['config']['Db'];
$dsn = $db_config['dsn'];
$dsn = split('[;:]', $dsn);
$db_type = array_shift($dsn);
$dbinfo = [
'type' => $db_type,
'user' => $db_config['user'],
@ -17,7 +17,6 @@ $dbinfo = [
'dbname' => 'xe_install',
'port' => ((isset($db_config['port']) && $db_config['port'])?: 3306),
];
foreach($dsn as $piece) {
list($key, $val) = explode('=', $piece);
$dbinfo[$key] = $val;