- Added Sudzy composer dependency for model validation

- All models now extend a generic Model class that extends Sudzy
- Wrote tests for Subscriber and Setting model validation
- Rewrote model tests to make sure they look the same
- Updated both tests with cleanup logic in the beginning
- Added test:unit-single method to Robo for selective unit testing

Closes #54
This commit is contained in:
Vlad
2015-08-11 23:48:21 +00:00
parent 0df8973b7e
commit 12bead358c
10 changed files with 361 additions and 118 deletions

View File

@@ -14,34 +14,20 @@ class RoboFile extends \Robo\Tasks {
}
function watch() {
$files = array(
// global admin styles
'assets/css/src/admin.styl',
// rtl specific styles
'assets/css/src/rtl.styl'
);
$files = array(// global admin styles
'assets/css/src/admin.styl', // rtl specific styles
'assets/css/src/rtl.styl');
$command = array(
'./node_modules/stylus/bin/stylus -u',
' nib -w'.
join(' ', $files).
' -o assets/css/'
);
$command = array('./node_modules/stylus/bin/stylus -u', ' nib -w' . join(' ', $files) . ' -o assets/css/');
$this->_exec(join(' ', $command));
}
function makepot() {
$this->_exec('grunt makepot'.
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__
);
$this->_exec('grunt makepot' . ' --gruntfile ' . __DIR__ . '/tasks/makepot/makepot.js' . ' --base_path ' . __DIR__);
}
function pushpot() {
$this->_exec('grunt pushpot'.
' --gruntfile '.__DIR__.'/tasks/makepot/makepot.js'.
' --base_path '.__DIR__
);
$this->_exec('grunt pushpot' . ' --gruntfile ' . __DIR__ . '/tasks/makepot/makepot.js' . ' --base_path ' . __DIR__);
}
function testUnit() {
@@ -50,13 +36,19 @@ class RoboFile extends \Robo\Tasks {
$this->_exec('vendor/bin/codecept run unit');
}
function testUnitSingle($unit = null) {
if (!$unit) {
throw new Exception("Your need to specify what you want to test (e.g.: test:unit-single models/SubscriberCest)");
}
$this->_exec('vendor/bin/codecept build');
$this->loadEnv();
$this->_exec('vendor/bin/codecept run unit ' . $unit);
}
function testAcceptance() {
$this->_exec('vendor/bin/codecept build');
$this->loadEnv();
$this
->taskExec('phantomjs --webdriver=4444')
->background()
->run();
$this->taskExec('phantomjs --webdriver=4444')->background()->run();
sleep(2);
$this->_exec('vendor/bin/codecept run acceptance');
}
@@ -64,10 +56,7 @@ class RoboFile extends \Robo\Tasks {
function testAll() {
$this->_exec('vendor/bin/codecept build');
$this->loadEnv();
$this
->taskexec('phantomjs --webdriver=4444')
->background()
->run();
$this->taskexec('phantomjs --webdriver=4444')->background()->run();
sleep(2);
$this->_exec('vendor/bin/codecept run');
}
@@ -82,15 +71,8 @@ class RoboFile extends \Robo\Tasks {
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
$this
->taskWriteToFile('tests/acceptance.suite.yml')
->textFromFile('tests/acceptance.suite.src')
->run();
$this->taskWriteToFile('tests/acceptance.suite.yml')->textFromFile('tests/acceptance.suite.src')->run();
$this
->taskReplaceInFile('tests/acceptance.suite.yml')
->regex("/url.*/")
->to('url: ' . "'" . getenv('WP_TEST_URL'). "'")
->run();
$this->taskReplaceInFile('tests/acceptance.suite.yml')->regex("/url.*/")->to('url: ' . "'" . getenv('WP_TEST_URL') . "'")->run();
}
}