Added tests for the Store (MySQL and PostgreSQL).

This commit is contained in:
Dmitry Khomutov 2018-03-01 19:36:28 +07:00
commit 42a8316479
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
14 changed files with 590 additions and 181 deletions

View file

@ -129,7 +129,7 @@ class Application extends b8\Application
{
$groups = [];
$groupStore = b8\Store\Factory::getStore('ProjectGroup');
$groupList = $groupStore->getWhere([], 100, 0, [], ['title' => 'ASC']);
$groupList = $groupStore->getWhere([], 100, 0, ['title' => 'ASC']);
foreach ($groupList['items'] as $group) {
$thisGroup = ['title' => $group->getTitle()];

View file

@ -225,7 +225,7 @@ class BuildStatusController extends Controller
{
$criteria = ['project_id' => $projectId];
$order = ['id' => 'DESC'];
$builds = $this->buildStore->getWhere($criteria, 10, 0, [], $order);
$builds = $this->buildStore->getWhere($criteria, 10, 0, $order);
foreach ($builds['items'] as &$build) {
$build = BuildFactory::getBuild($build);

View file

@ -37,7 +37,7 @@ class GroupController extends Controller
$this->requireAdmin();
$groups = [];
$groupList = $this->groupStore->getWhere([], 100, 0, [], ['title' => 'ASC']);
$groupList = $this->groupStore->getWhere([], 100, 0, ['title' => 'ASC']);
foreach ($groupList['items'] as $group) {
$thisGroup = [

View file

@ -273,7 +273,7 @@ class ProjectController extends PHPCensor\Controller
}
$order = ['id' => 'DESC'];
$builds = $this->buildStore->getWhere($criteria, $perPage, $start, [], $order);
$builds = $this->buildStore->getWhere($criteria, $perPage, $start, $order);
$view = new View('Project/ajax-builds');
foreach ($builds['items'] as &$build) {
@ -496,7 +496,7 @@ class ProjectController extends PHPCensor\Controller
$groups = [];
$groupStore = b8\Store\Factory::getStore('ProjectGroup');
$groupList = $groupStore->getWhere([], 100, 0, [], ['title' => 'ASC']);
$groupList = $groupStore->getWhere([], 100, 0, ['title' => 'ASC']);
foreach ($groupList['items'] as $group) {
$groups[$group->getId()] = $group->getTitle();

View file

@ -42,7 +42,7 @@ class UserController extends Controller
*/
public function index()
{
$users = $this->userStore->getWhere([], 1000, 0, [], ['email' => 'ASC']);
$users = $this->userStore->getWhere([], 1000, 0, ['email' => 'ASC']);
$this->view->users = $users;
$this->layout->title = Lang::get('manage_users');

View file

@ -76,7 +76,6 @@ class WidgetAllProjectsController extends Controller
['project_id' => $project->getId()],
1,
0,
[],
['id' => 'DESC']
);
$counts[$project->getId()] = $count['count'];
@ -107,7 +106,7 @@ class WidgetAllProjectsController extends Controller
protected function getGroupInfo()
{
$rtn = [];
$groups = $this->groupStore->getWhere([], 100, 0, [], ['title' => 'ASC']);
$groups = $this->groupStore->getWhere([], 100, 0, ['title' => 'ASC']);
foreach ($groups['items'] as $group) {
$thisGroup = ['title' => $group->getTitle()];
@ -133,7 +132,6 @@ class WidgetAllProjectsController extends Controller
['project_id' => $projectId],
1,
0,
[],
['id' => 'DESC']
);
$counts = $count['count'];

View file

@ -512,7 +512,7 @@ class Project extends Model
}
$order = ['id' => 'DESC'];
$builds = Store\Factory::getStore('Build')->getWhere($criteria, 1, 0, [], $order);
$builds = Store\Factory::getStore('Build')->getWhere($criteria, 1, 0, $order);
if (is_array($builds['items']) && count($builds['items'])) {
$latest = array_shift($builds['items']);
@ -536,7 +536,7 @@ class Project extends Model
{
$criteria = ['branch' => $branch, 'project_id' => $this->getId()];
$order = ['id' => 'DESC'];
$builds = Store\Factory::getStore('Build')->getWhere($criteria, 1, 1, [], $order);
$builds = Store\Factory::getStore('Build')->getWhere($criteria, 1, 1, $order);
if (is_array($builds['items']) && count($builds['items'])) {
$previous = array_shift($builds['items']);

View file

@ -33,7 +33,7 @@ class ProjectStore extends Store
* @param integer $key
* @param string $useConnection
*
* @return null|Project
* @return Project|null
*/
public function getByPrimaryKey($key, $useConnection = 'read')
{
@ -46,7 +46,7 @@ class ProjectStore extends Store
* @param integer $id
* @param string $useConnection
*
* @return null|Project
* @return Project|null
*
* @throws HttpException
*/