diff options
Diffstat (limited to 'site/app/tests/controllers/editors_controller.test.php')
-rw-r--r-- | site/app/tests/controllers/editors_controller.test.php | 178 |
1 files changed, 0 insertions, 178 deletions
diff --git a/site/app/tests/controllers/editors_controller.test.php b/site/app/tests/controllers/editors_controller.test.php index 7f86245..2cd1853 100644 --- a/site/app/tests/controllers/editors_controller.test.php +++ b/site/app/tests/controllers/editors_controller.test.php @@ -43,18 +43,6 @@ class EditorsControllerTest extends WebTestHelper { 'feature_locales' => 'en-US,fr,de' ); - var $queuedata = array( - 'addonid' => 4022, - 'name' => 'Chrome List', - 'addontypeid' => 1, - 'platformid' => 2, - 'applicationid' => 1, - ); - - var $performancedata = array( - 'userid' => 5, - ); - /** * Setup the Editors Controller */ @@ -65,10 +53,6 @@ class EditorsControllerTest extends WebTestHelper { $this->Addon =& new Addon(); $this->Addon->caching = false; $this->Addon->cacheQueries = false; - - $this->helper = new UnitTestHelper(); - $this->controller =& $this->helper->getController('Editors', $this); - $this->helper->mockComponents($this->controller, $this); } function testAddFeature() { @@ -149,156 +133,6 @@ class EditorsControllerTest extends WebTestHelper { $this->assertResponse(array('400'), "Invalid GET removal request gets appropriate response."); } - function testPendingQueueFilter() { - $addonName = $this->queuedata['name']; - $addonAppId = $this->queuedata['applicationid']; - $addonType = $this->queuedata['addontypeid']; - $addonPlatform = $this->queuedata['platformid']; - $nameSearch = substr($addonName, 0, -4); - - $path = $this->actionURI('/editors/queue/pending'); - - // login - $this->login(); - - // test no filter - $this->get($path); - $this->clickSubmitByName('clear'); - $this->assertText($addonName, "'$addonName' in unfiltered queue."); - - // filters that include add-on - $this->clickSubmitByName('filter', array('data[Filter][AddonOrAuthor]' => $nameSearch)); - $this->assertText($addonName, "'$addonName' in queue with Addon filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][Application]' => $addonAppId)); - $this->assertText($addonName, "'$addonName' in queue with Application filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][SubmissionAge]' => '10+')); - $this->assertText($addonName, "'$addonName' in queue with Age filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][Addontype][]' => $addonType)); - $this->assertText($addonName, "'$addonName' in queue with Addontype filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][Platform][]' => $addonPlatform)); - $this->assertText($addonName, "'$addonName' in queue with Platform filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array( - 'data[Filter][AddonOrAuthor]' => $nameSearch, - 'data[Filter][Application]' => $addonAppId, - 'data[Filter][SubmissionAge]' => '10+', - 'data[Filter][Addontype][]' => $addonType, - 'data[Filter][AddonPlatform][]' => $addonPlatform) - ); - $this->assertText($addonName, "'$addonName' in queue with multi-field filter."); - - // filters that exclude add-on - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][AddonOrAuthor]' => "{$nameSearch}wolf!")); - $this->assertNoText($addonName, "'$addonName' not in queue with unmatching Addon filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][Application]' => $addonAppId+12345)); - $this->assertNoText($addonName, "'$addonName' not in queue with unmatching Application filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][SubmissionAge]' => 1)); - $this->assertNoText($addonName, "'$addonName' not in queue with unmatching Age filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][Addontype][]' => $addonType+12345)); - $this->assertNoText($addonName, "'$addonName' not in queue with unmatching Addontype filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][Platform][]' => $addonPlatform+12345)); - $this->assertNoText($addonName, "'$addonName' not in queue with unmatching Platform filter."); - } - - function testNominatedQueueFilter() { - $addonName = $this->queuedata['name']; - $addonAppId = $this->queuedata['applicationid']; - $addonType = $this->queuedata['addontypeid']; - $nameSearch = substr($addonName, 0, -4); - - $path = $this->actionURI('/editors/queue/nominated'); - - // login - $this->login(); - - // initially our test add-on should NOT be in the nominated queue - $this->get($path); - $this->clickSubmitByName('clear'); - $this->assertNoText($addonName, "'$addonName' (status=PUBLIC) not in unfiltered queue."); - - // now temporarily change the status (and nomination date) - $this->_setNominatedStatus(); - - // test no filter - $this->clickSubmitByName('clear'); - $this->assertText($addonName, "'$addonName' in unfiltered queue."); - - // filters that include add-on - $this->clickSubmitByName('filter', array('data[Filter][AddonOrAuthor]' => $nameSearch)); - $this->assertText($addonName, "'$addonName' in queue with Addon filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][Application]' => $addonAppId)); - $this->assertText($addonName, "'$addonName' in queue with Application filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][SubmissionAge]' => '3')); - $this->assertText($addonName, "'$addonName' in queue with Age filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][Addontype][]' => $addonType)); - $this->assertText($addonName, "'$addonName' in queue with Addontype filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array( - 'data[Filter][AddonOrAuthor]' => $nameSearch, - 'data[Filter][Application]' => $addonAppId, - 'data[Filter][SubmissionAge]' => 3, - 'data[Filter][Addontype][]' => $addonType) - ); - $this->assertText($addonName, "'$addonName' in queue with multi-field filter."); - - // filters that exclude add-on - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][AddonOrAuthor]' => "{$nameSearch}robot!")); - $this->assertNoText($addonName, "'$addonName' not in queue with unmatching Addon filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][Application]' => $addonAppId+12345)); - $this->assertNoText($addonName, "'$addonName' not in queue with unmatching Application filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][SubmissionAge]' => 1)); - $this->assertNoText($addonName, "'$addonName' not in queue with unmatching Age filter."); - - $this->clickSubmitByName('clear'); - $this->clickSubmitByName('filter', array('data[Filter][Addontype][]' => $addonType+12345)); - $this->assertNoText($addonName, "'$addonName' not in queue with unmatching Addontype filter."); - - // restore changed status - $this->_restoreStatus(); - } - - function testPerformanceByCategory() { - $summary = $this->controller->_performanceSummaryByCategory($this->performancedata['userid']); - $this->assertTrue(array_sum($summary['usercount']) > 0, 'user has approvals in category breakdown summary'); - $this->assertTrue(array_sum($summary['teamcount']) > 0, 'team has approvals in category breakdown summary'); - } - - function testPerformanceByMonth() { - $summary = $this->controller->_performanceSummaryByMonth($this->performancedata['userid']); - $this->assertTrue(array_sum($summary['usercount']) > 0, 'user has approvals in monthly summary'); - $this->assertTrue(array_sum($summary['teamcount']) > 0, 'team has approvals in monthly summary'); - } - /** * We've got to use direct queries here because cake 1.1 doesn't support getting data in join tables. :-/ */ @@ -314,16 +148,4 @@ class EditorsControllerTest extends WebTestHelper { function _removeTestData() { $this->Addon->execute("DELETE FROM `addons_tags` WHERE addon_id={$this->testdata['addonid']} AND tag_id={$this->testdata['tagid']} LIMIT 1"); } - - - /** - * Test data doesn't have any nominated addons. We'll use these methods to nominate temporarily - */ - function _setNominatedStatus() { - $this->Addon->execute("UPDATE `addons` SET `status`=".STATUS_NOMINATED.", nominationdate=DATE_SUB(NOW(), INTERVAL 3 DAY) WHERE id={$this->queuedata['addonid']} LIMIT 1"); - } - - function _restoreStatus() { - $this->Addon->execute("UPDATE `addons` SET `status`=".STATUS_PUBLIC.", nominationdate=0 WHERE id={$this->queuedata['addonid']} LIMIT 1"); - } } |