Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_retention.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-01-05 17:54:51 +0300
committerGitHub <noreply@github.com>2017-01-05 17:54:51 +0300
commita7030c9bcbf3fda6a88261a2f1781f02b4154cca (patch)
treeb5e7b3d0e33e92963762332bce21ed507ff0b75a /tests
parentcfa4056176d49af600f7af32abad65eaaf74d5d2 (diff)
parente48b38c28f93feb26352478d006274e73e5f834d (diff)
Merge pull request #17 from nextcloud/fix_15
Delete job if tag not found
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/BackgroundJob/RetentionJobTest.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/lib/BackgroundJob/RetentionJobTest.php b/tests/lib/BackgroundJob/RetentionJobTest.php
index 628affb..004079f 100644
--- a/tests/lib/BackgroundJob/RetentionJobTest.php
+++ b/tests/lib/BackgroundJob/RetentionJobTest.php
@@ -20,7 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-namespace OCA\Files_Retention\Tests\BackgroundJob\RententionJobTest;
+namespace OCA\Files_Retention\Tests\BackgroundJob;
use OCA\Files_Retention\BackgroundJob\RetentionJob;
use OCA\Files_Retention\Constants;
@@ -36,11 +36,13 @@ use OCP\Files\IRootFolder;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\ISystemTagObjectMapper;
use OCP\IUser;
+use OCP\SystemTag\TagNotFoundException;
+use Test\TestCase;
/**
* @group DB
*/
-class RetentionJobTest extends \Test\TestCase {
+class RetentionJobTest extends TestCase {
/** @var ISystemTagManager|\PHPUnit_Framework_MockObject_MockObject */
private $tagManager;
@@ -203,7 +205,7 @@ class RetentionJobTest extends \Test\TestCase {
$this->retentionJob->run(['tag' => 42]);
}
- public function testNoSuchTag() {
+ public function testInvalidTag() {
$this->tagManager->expects($this->once())
->method('getTagsByIds')
->will($this->throwException(new \InvalidArgumentException()));
@@ -215,6 +217,18 @@ class RetentionJobTest extends \Test\TestCase {
$this->retentionJob->run(['tag' => 42]);
}
+ public function testNoSuchTag() {
+ $this->tagManager->expects($this->once())
+ ->method('getTagsByIds')
+ ->will($this->throwException(new TagNotFoundException()));
+
+ $this->jobList->expects($this->once())
+ ->method('remove')
+ ->with($this->equalTo($this->retentionJob), $this->equalTo(['tag' => 42]));
+
+ $this->retentionJob->run(['tag' => 42]);
+ }
+
public function testNoSuchRetention() {
// Tag exists
$this->tagManager->expects($this->once())