mirror of
https://github.com/friendica/friendica
synced 2025-04-30 21:44:22 +02:00
Refactoring DBA-mocking tests
- Reducing DB-dependencies - Creating DB-cache mocks - Creating DB-lock mocks - Switching to mocked dependencies for Cache/Lock/App
This commit is contained in:
parent
f7e95f65b1
commit
433d6abe8c
21 changed files with 848 additions and 193 deletions
|
@ -7,20 +7,33 @@ namespace Friendica\Test;
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Util\LoggerFactory;
|
||||
use Friendica\Test\Util\AppMockTrait;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Tests for the BaseObject class.
|
||||
* @runTestsInSeparateProcesses
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
class BaseObjectTest extends TestCase
|
||||
{
|
||||
use VFSTrait;
|
||||
use AppMockTrait;
|
||||
|
||||
/**
|
||||
* @var BaseObject
|
||||
*/
|
||||
private $baseObject;
|
||||
|
||||
/**
|
||||
* Create variables used in tests.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->setUpVfsDir();
|
||||
$this->mockApp($this->root);
|
||||
|
||||
$this->baseObject = new BaseObject();
|
||||
}
|
||||
|
||||
|
@ -39,10 +52,7 @@ class BaseObjectTest extends TestCase
|
|||
*/
|
||||
public function testSetApp()
|
||||
{
|
||||
$logger = $logger = LoggerFactory::create('test');
|
||||
$app = new App(__DIR__ . '/../../', $logger);
|
||||
LoggerFactory::enableTest($logger);
|
||||
$this->assertNull($this->baseObject->setApp($app));
|
||||
$this->assertEquals($app, $this->baseObject->getApp());
|
||||
$this->assertNull($this->baseObject->setApp($this->app));
|
||||
$this->assertEquals($this->app, $this->baseObject->getApp());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue