Added job for property reading
This commit is contained in:
parent
700f2bc8ae
commit
1bc219a162
6 changed files with 51 additions and 6 deletions
18
src/Api/Jobs/GetPropertyJob.php
Normal file
18
src/Api/Jobs/GetPropertyJob.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
class GetPropertyJob extends AbstractJob
|
||||
{
|
||||
public function execute()
|
||||
{
|
||||
return PropertyModel::get($this->getArgument(JobArgs::ARG_QUERY));
|
||||
}
|
||||
|
||||
public function getRequiredArguments()
|
||||
{
|
||||
return JobArgs::ARG_QUERY;
|
||||
}
|
||||
|
||||
public function getRequiredPrivileges()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -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(),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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));
|
||||
|
|
19
tests/Tests/JobTests/GetPropertyJobTest.php
Normal file
19
tests/Tests/JobTests/GetPropertyJobTest.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
class GetPropertyJobTest extends AbstractTest
|
||||
{
|
||||
public function testRetrieval()
|
||||
{
|
||||
$key = PropertyModel::DbVersion;
|
||||
|
||||
$ret = $this->assert->doesNotThrow(function() use ($key)
|
||||
{
|
||||
return Api::run(
|
||||
new GetPropertyJob(),
|
||||
[
|
||||
JobArgs::ARG_QUERY => $key,
|
||||
]);
|
||||
});
|
||||
|
||||
$this->assert->areEqual(PropertyModel::get($key), $ret);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue