summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-09-13 18:29:34 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-09-13 18:29:34 +0200
commit6b138b98a6a92d31263dfcf8075e432f0df40649 (patch)
tree8f647ec1491de674f3093f24fad21521d25eec01 /tests
parente178dc843a677fe2512ebd2247e20016eb18cd5b (diff)
use before and after update hooks to delete items only after new ones have been fetched
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/external/NewsAPITest.php23
-rw-r--r--tests/unit/utility/UpdaterTest.php10
2 files changed, 25 insertions, 8 deletions
diff --git a/tests/unit/external/NewsAPITest.php b/tests/unit/external/NewsAPITest.php
index a14faafc7..0f3031090 100644
--- a/tests/unit/external/NewsAPITest.php
+++ b/tests/unit/external/NewsAPITest.php
@@ -66,9 +66,14 @@ class NewsAPITest extends ControllerTestUtility {
$this->assertDefaultAnnotations('version');
}
- public function testCleanUpAnnotations(){
+ public function testBeforeUpdateAnnotations(){
$annotations = array('Ajax', 'CSRFExemption', 'API');
- $this->assertAnnotations($this->newsAPI, 'cleanUp', $annotations);
+ $this->assertAnnotations($this->newsAPI, 'beforeUpdate', $annotations);
+ }
+
+ public function testAfterUpdateAnnotations(){
+ $annotations = array('Ajax', 'CSRFExemption', 'API');
+ $this->assertAnnotations($this->newsAPI, 'afterUpdate', $annotations);
}
public function testGetVersion(){
@@ -85,10 +90,18 @@ class NewsAPITest extends ControllerTestUtility {
}
- public function testCleanUp(){
+ public function testBeforeUpdate(){
+ $this->updater->expects($this->once())
+ ->method('beforeUpdate');
+ $response = $this->newsAPI->beforeUpdate();
+ $this->assertTrue($response instanceof JSONResponse);
+ }
+
+
+ public function testAfterUpdate(){
$this->updater->expects($this->once())
- ->method('cleanUp');
- $response = $this->newsAPI->cleanUp();
+ ->method('afterUpdate');
+ $response = $this->newsAPI->afterUpdate();
$this->assertTrue($response instanceof JSONResponse);
}
diff --git a/tests/unit/utility/UpdaterTest.php b/tests/unit/utility/UpdaterTest.php
index 8a900d15e..2e6b03351 100644
--- a/tests/unit/utility/UpdaterTest.php
+++ b/tests/unit/utility/UpdaterTest.php
@@ -58,17 +58,21 @@ class UpdaterTest extends \PHPUnit_Framework_TestCase {
$this->itemBusinessLayer);
}
- public function testCleanUp() {
+ public function testBeforeUpdate() {
$this->folderBusinessLayer->expects($this->once())
->method('purgeDeleted');
$this->feedBusinessLayer->expects($this->once())
->method('purgeDeleted');
+ $this->updater->beforeUpdate();
+ }
+
+
+ public function testAfterUpdate() {
$this->itemBusinessLayer->expects($this->once())
->method('autoPurgeOld');
- $this->updater->cleanUp();
+ $this->updater->afterUpdate();
}
-
public function testUpdate() {
$this->feedBusinessLayer->expects($this->once())
->method('updateAll');