diff --git a/src/Api/Jobs/GetPropertyJob.php b/src/Api/Jobs/GetPropertyJob.php new file mode 100644 index 00000000..cd497972 --- /dev/null +++ b/src/Api/Jobs/GetPropertyJob.php @@ -0,0 +1,18 @@ +getArgument(JobArgs::ARG_QUERY)); + } + + public function getRequiredArguments() + { + return JobArgs::ARG_QUERY; + } + + public function getRequiredPrivileges() + { + return false; + } +} diff --git a/tests/Tests/ApiTests/ApiArgumentTest.php b/tests/Tests/ApiTests/ApiArgumentTest.php index d673837f..10c9ad6d 100644 --- a/tests/Tests/ApiTests/ApiArgumentTest.php +++ b/tests/Tests/ApiTests/ApiArgumentTest.php @@ -184,6 +184,11 @@ class ApiArgumentTest extends AbstractFullApiTest JobArgs::Optional(JobArgs::ARG_PAGE_NUMBER))); } + public function testGetPropertyJob() + { + $this->testArguments(new GetPropertyJob(), JobArgs::ARG_QUERY); + } + public function testGetPostContentJob() { $this->testArguments(new GetPostContentJob(), diff --git a/tests/Tests/ApiTests/ApiAuthTest.php b/tests/Tests/ApiTests/ApiAuthTest.php index bb8eb928..ee6f958f 100644 --- a/tests/Tests/ApiTests/ApiAuthTest.php +++ b/tests/Tests/ApiTests/ApiAuthTest.php @@ -12,16 +12,16 @@ class ApiAuthTest extends AbstractFullApiTest $this->testAuth(new DeleteCommentJob(), true); $this->testAuth(new DeleteUserJob(), false); $this->testAuth(new EditCommentJob(), true); - $this->testAuth(new EditPostContentJob(), false); $this->testAuth(new EditPostJob(), false); + $this->testAuth(new EditPostContentJob(), false); $this->testAuth(new EditPostRelationsJob(), false); $this->testAuth(new EditPostSafetyJob(), false); $this->testAuth(new EditPostSourceJob(), false); $this->testAuth(new EditPostTagsJob(), false); $this->testAuth(new EditPostThumbJob(), false); + $this->testAuth(new EditUserJob(), false); $this->testAuth(new EditUserAccessRankJob(), false); $this->testAuth(new EditUserEmailJob(), false); - $this->testAuth(new EditUserJob(), false); $this->testAuth(new EditUserNameJob(), false); $this->testAuth(new EditUserPasswordJob(), false); $this->testAuth(new EditUserSettingsJob(), false); @@ -29,8 +29,9 @@ class ApiAuthTest extends AbstractFullApiTest $this->testAuth(new FlagPostJob(), false); $this->testAuth(new FlagUserJob(), false); $this->testAuth(new GetLogJob(), false); - $this->testAuth(new GetPostContentJob(), false); + $this->testAuth(new GetPropertyJob(), false); $this->testAuth(new GetPostJob(), false); + $this->testAuth(new GetPostContentJob(), false); $this->testAuth(new GetPostThumbJob(), false); $this->testAuth(new GetUserJob(), false); $this->testAuth(new GetUserSettingsJob(), false); diff --git a/tests/Tests/ApiTests/ApiEmailRequirementsTest.php b/tests/Tests/ApiTests/ApiEmailRequirementsTest.php index 6cf63868..8aceb739 100644 --- a/tests/Tests/ApiTests/ApiEmailRequirementsTest.php +++ b/tests/Tests/ApiTests/ApiEmailRequirementsTest.php @@ -13,16 +13,16 @@ class ApiEmailRequirementsTest extends AbstractFullApiTest $this->testRegularEmailRequirement(new DeleteCommentJob()); $this->testRegularEmailRequirement(new DeleteUserJob()); $this->testRegularEmailRequirement(new EditCommentJob()); - $this->testRegularEmailRequirement(new EditPostContentJob()); $this->testRegularEmailRequirement(new EditPostJob()); + $this->testRegularEmailRequirement(new EditPostContentJob()); $this->testRegularEmailRequirement(new EditPostRelationsJob()); $this->testRegularEmailRequirement(new EditPostSafetyJob()); $this->testRegularEmailRequirement(new EditPostSourceJob()); $this->testRegularEmailRequirement(new EditPostTagsJob()); $this->testRegularEmailRequirement(new EditPostThumbJob()); + $this->testRegularEmailRequirement(new EditUserJob()); $this->testRegularEmailRequirement(new EditUserAccessRankJob()); $this->testRegularEmailRequirement(new EditUserEmailJob()); - $this->testRegularEmailRequirement(new EditUserJob()); $this->testRegularEmailRequirement(new EditUserNameJob()); $this->testRegularEmailRequirement(new EditUserPasswordJob()); $this->testRegularEmailRequirement(new EditUserSettingsJob()); @@ -30,8 +30,9 @@ class ApiEmailRequirementsTest extends AbstractFullApiTest $this->testRegularEmailRequirement(new FlagPostJob()); $this->testRegularEmailRequirement(new FlagUserJob()); $this->testRegularEmailRequirement(new GetLogJob()); - $this->testRegularEmailRequirement(new GetPostContentJob()); + $this->testRegularEmailRequirement(new GetPropertyJob()); $this->testRegularEmailRequirement(new GetPostJob()); + $this->testRegularEmailRequirement(new GetPostContentJob()); $this->testRegularEmailRequirement(new GetPostThumbJob()); $this->testRegularEmailRequirement(new GetUserJob()); $this->testRegularEmailRequirement(new GetUserSettingsJob()); diff --git a/tests/Tests/ApiTests/ApiPrivilegeTest.php b/tests/Tests/ApiTests/ApiPrivilegeTest.php index f5159c26..acbd8258 100644 --- a/tests/Tests/ApiTests/ApiPrivilegeTest.php +++ b/tests/Tests/ApiTests/ApiPrivilegeTest.php @@ -19,6 +19,7 @@ class ApiPrivilegeTest extends AbstractFullApiTest $this->testRegularPrivilege(new AddUserJob(), new Privilege(Privilege::RegisterAccount)); $this->testRegularPrivilege(new EditUserJob(), false); $this->testRegularPrivilege(new GetLogJob(), new Privilege(Privilege::ViewLog)); + $this->testRegularPrivilege(new GetPropertyJob(), false); $this->testRegularPrivilege(new ListCommentsJob(), new Privilege(Privilege::ListComments)); $this->testRegularPrivilege(new ListLogsJob(), new Privilege(Privilege::ListLogs)); $this->testRegularPrivilege(new ListPostsJob(), new Privilege(Privilege::ListPosts)); diff --git a/tests/Tests/JobTests/GetPropertyJobTest.php b/tests/Tests/JobTests/GetPropertyJobTest.php new file mode 100644 index 00000000..7c3c61f1 --- /dev/null +++ b/tests/Tests/JobTests/GetPropertyJobTest.php @@ -0,0 +1,19 @@ +assert->doesNotThrow(function() use ($key) + { + return Api::run( + new GetPropertyJob(), + [ + JobArgs::ARG_QUERY => $key, + ]); + }); + + $this->assert->areEqual(PropertyModel::get($key), $ret); + } +}