From 35ba99d8825d3638e4318b599d129d1cc5122f4b Mon Sep 17 00:00:00 2001 From: Jacson Passold Date: Fri, 26 Jan 2018 16:44:45 -0200 Subject: [PATCH] test item moderation --- tests/test-items.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/test-items.php b/tests/test-items.php index 522be3455..4c9664208 100644 --- a/tests/test-items.php +++ b/tests/test-items.php @@ -16,7 +16,7 @@ use Tainacan\Entities; class Items extends TAINACAN_UnitTestCase { /** - * @group permissions + * @group permissions2 */ public function test_permissions () { $collection = $this->tainacan_entity_factory->create_entity( @@ -36,6 +36,28 @@ class Items extends TAINACAN_UnitTestCase { ); $this->assertTrue($item->can_read(), 'Administrator cannot read the Item'); $this->assertTrue($item->can_edit(), 'Administrator cannot edit the Item'); + + $sub = $this->factory()->user->create(array( 'role' => 'subscriber', 'display_name' => 'Sub' )); + + $collectionM = $this->tainacan_entity_factory->create_entity( + 'collection', + array( + 'name' => 'testePermModerator', + 'moderators_ids' => [$sub] + ), + true + ); + $itemM = $this->tainacan_entity_factory->create_entity( + 'item', + array( + 'title' => 'testeItemModerator', + 'collection' => $collectionM, + ), + true + ); + $this->assertEquals([$sub], $collectionM->get_moderators_ids()); + $this->assertTrue($itemM->can_edit($sub), 'Moderators cannot edit a item!'); + } function teste_query(){