szurubooru/tests/Tests/AbstractTest.php

46 lines
927 B
PHP
Raw Normal View History

2014-05-04 21:23:12 +02:00
<?php
class AbstractTest
{
public $assert;
protected $postMocker;
protected $tagMocker;
protected $userMocker;
protected $commentMocker;
protected $testSupport;
2014-05-04 21:23:12 +02:00
public function __construct()
{
$this->assert = new Assert();
$this->testSupport = new TestSupport($this->assert);
$this->tagMocker = new TagMocker();
$this->postMocker = new PostMocker($this->tagMocker, $this->testSupport);
$this->userMocker = new UserMocker();
$this->commentMocker = new CommentMocker($this->postMocker);
2014-05-04 21:23:12 +02:00
}
public function setup()
{
}
public function teardown()
{
}
protected function login($user)
{
Auth::setCurrentUser($user);
}
2014-05-06 13:07:24 +02:00
protected function grantAccess($privilege)
{
2014-05-15 10:32:53 +02:00
Core::getConfig()->privileges->$privilege = 'anonymous';
2014-08-23 14:15:04 +02:00
Access::initWithoutCache();
2014-05-06 13:07:24 +02:00
}
protected function revokeAccess($privilege)
{
2014-05-15 10:32:53 +02:00
Core::getConfig()->privileges->$privilege = 'nobody';
2014-08-23 14:15:04 +02:00
Access::initWithoutCache();
2014-05-06 13:07:24 +02:00
}
2014-05-04 21:23:12 +02:00
}