Skip to content

Commit

Permalink
fixing up some tests, set travis email notifications to false
Browse files Browse the repository at this point in the history
  • Loading branch information
ceeram committed Jun 22, 2012
1 parent da89ae4 commit c38b123
Show file tree
Hide file tree
Showing 12 changed files with 476 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ script:
- Console/cake test app AllTests

notifications:
irc: "irc.freenode.org#infinitas"
irc: "irc.freenode.org#infinitas"
email: false
2 changes: 2 additions & 0 deletions Core/Configs/Test/Case/Controller/ConfigsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function redirect($url, $status = null, $exit = true) {
}

class ConfigsControllerTest extends CakeTestCase {
public $fixtures = array('plugin.configs.config');

function startTest() {
$this->Configs = new TestConfigsController();
$this->Configs->constructClasses();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ function redirect($url, $status = null, $exit = true) {
}

class GlobalCategoriesControllerTest extends CakeTestCase {

public $fixtures = array('plugin.configs.config');

function startTest() {
$this->Categories = new TestCategoriesController();
$this->Categories->constructClasses();
Expand Down
10 changes: 8 additions & 2 deletions Core/Contents/Test/Case/Controller/GlobalTagsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestTagsController extends GlobalTagsController {

public $uses = array('Contents.GlobalTag');

public $components = array('Paginator');
public $components = array('Paginator', 'Libs.InfinitasActions');
/**
* Auto render
*
Expand Down Expand Up @@ -89,8 +89,11 @@ public function startTest() {
$this->GlobalTags = new TestTagsController(new CakeRequest('controller_posts/admin_index'));
$this->GlobalTags->params = array(
'named' => array(),
'url' => array());
'url' => array(),
'pass' => array()
);
$this->GlobalTags->constructClasses();
$this->GlobalTags->InfinitasActions->initialize($this->GlobalTags);
}

/**
Expand Down Expand Up @@ -132,6 +135,7 @@ public function testAdminIndex() {
* @access public
*/
public function testAdminAdd() {
$this->GlobalTags->request->params['action'] = 'admin_add';
$this->GlobalTags->request->data = array(
'Tag' => array(
'tags' => 'tag1, tag2, tag3'));
Expand All @@ -148,6 +152,8 @@ public function testAdminAdd() {
* @access public
*/
public function testAdminEdit() {
$this->GlobalTags->request->params['action'] = 'admin_edit';
$this->GlobalTags->request->params['pass'] = array(1);
$this->GlobalTags->admin_edit(1);
$result = $this->GlobalTags->request->data;
$expected = array(
Expand Down
20 changes: 10 additions & 10 deletions Core/Libs/Controller/Component/InfinitasActionsComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function actionAdminGetActions() {
$this->Controller->set('json', array('error'));
return;
}

$this->Controller->set(
'json',
$this->Controller->{$this->Controller->modelClass}->getActions(
Expand All @@ -92,7 +92,7 @@ public function actionAdminGetRecords() {
$this->Controller->set('json', array('error'));
return;
}

$this->Controller->set(
'json',
$this->Controller->{$this->Controller->modelClass}->getRecords(
Expand All @@ -101,7 +101,7 @@ public function actionAdminGetRecords() {
)
);
}

/**
* @brief Simple Admin add method.
*
Expand All @@ -119,11 +119,11 @@ public function actionAdminGetRecords() {
public function actionAdminAdd() {
if (!empty($this->Controller->request->data)) {
$this->Controller->{$this->Controller->modelClass}->create();

if ($this->Controller->{$this->Controller->modelClass}->saveAll($this->Controller->request->data)) {
$this->Controller->notice('saved');
}

$this->Controller->notice('not_saved');
}

Expand Down Expand Up @@ -154,7 +154,7 @@ public function actionAdminEdit($id = null, $query = array()) {
if ($this->Controller->{$this->Controller->modelClass}->saveAll($this->Controller->request->data)) {
$this->Controller->notice('saved');
}

$this->Controller->notice('not_saved');
}

Expand Down Expand Up @@ -208,10 +208,10 @@ public function actionAdminPreview($id = null) {
$this->Controller->set($varName, $$varName);
$this->Controller->request->params['admin'] = false;
$this->Controller->layout = 'front';

$this->Controller->render('view');
}

public function actionAdminExport($id = null) {
$this->Controller->notice(
__d($this->Controller->request->params['plugin'], 'Export is currently disabled'),
Expand Down Expand Up @@ -291,7 +291,7 @@ public function actionAdminReorder($id = null) {
$redirectConfig
);
}

$this->Controller->Infinitas->orderedMove();
}

Expand All @@ -302,7 +302,7 @@ public function actionAdminReorder($id = null) {
$redirectConfig
);
}

$this->Controller->Infinitas->treeMove($this->Controller->request->params['named']['direction']);
}

Expand Down
8 changes: 4 additions & 4 deletions Core/Libs/Controller/Component/InfinitasComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,18 +288,18 @@ public function treeMove($direction) {
if (!$this->Controller->{$model}->moveUp($check[$model]['id'], abs(1))) {
$message = __('Unable to move the record up');
}

else {
$this->Controller->{$model}->afterSave(false);
}
break;

case 'down':
$message = __('The record was moved down');
if (!$this->Controller->{$model}->moveDown($check[$model]['id'], abs(1))) {
$message = __('Unable to move the record down');
}

else {
$this->Controller->{$model}->afterSave(false);
}
Expand All @@ -321,7 +321,7 @@ public function treeMove($direction) {
*/
public function orderedMove() {
$modelName = $this->Controller->modelClass;

$orderable = isset($this->Controller->{$modelName}->actsAs['Libs.Sequence']['groupFields']) &&
!empty($this->Controller->{$modelName}->actsAs['Libs.Sequence']['groupFields']);

Expand Down
8 changes: 4 additions & 4 deletions Core/Libs/Test/Case/Model/Behavior/InfinitasTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
<?php
/* Infinitas Test cases generated on: 2010-03-13 14:03:31 : 1268484451*/
App::uses('InfinitasBehavior', 'Libs.Model/Behavior');
App::uses('Route', 'Routes.Model');

class RouteTest1 extends Route {
public $useDbConfig = 'test';

Expand Down Expand Up @@ -36,10 +36,10 @@ public function setUp() {
$this->expectError(true);
$this->AppModel = new AppModel(array('table' => false));
}

public function tearDown() {
parent::tearDown();

unset($this->Infinitas);
}

Expand Down
11 changes: 5 additions & 6 deletions Core/Libs/Test/Case/Model/Behavior/LockableTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
App::import('Model', 'Cms.Content');
<?php
class LockableContent extends CakeTestModel{
public $useDbConfig = 'test';
public $useTable = 'cms_content';
Expand All @@ -14,10 +13,10 @@ class LockableTestCase extends CakeTestCase {

//need something to set with
var $fixtures = array(
'plugin.categories.global_category',
'plugin.cms.content',
'plugin.contents.global_category',
'plugin.cms.cms_content',
'plugin.management.ticket',
'plugin.management.group'
'plugin.users.group'
);

function startTest() {
Expand All @@ -42,7 +41,7 @@ function testLocking() {
}

function endTest() {
unset($this->Infinitas);
unset($this->LockableContent);
ClassRegistry::flush();
}
}
6 changes: 3 additions & 3 deletions Core/Libs/Test/Case/Vendors/Shells/Tasks/ProgressBarTaskTest.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php
/**
* ProgressBarTask Test Cases
*
Expand Down Expand Up @@ -83,9 +83,9 @@ class ProgressBarTaskTest extends CakeTestCase {
* @access public
*/
public function startTest() {
$this->Dispatcher = new TestProgressBarTaskMockShellDispatcher();
$this->Dispatcher = new ShellDispatcher();
$this->Dispatcher->shellPaths = App::path('shells');
$this->Task = new MockProgressBarTask($this->Dispatcher);
$this->Task = new TestProgressBarTask($this->Dispatcher);
$this->Task->Dispatch = $this->Dispatcher;
$this->Task->path = TMP . 'tests' . DS;
}
Expand Down

0 comments on commit c38b123

Please sign in to comment.