6 namespace Friendica\Test;
9 use Friendica\Core\Config\Cache;
10 use Friendica\Core\Config\IConfig;
11 use Friendica\Core\Session;
12 use Friendica\Core\Session\ISession;
13 use Friendica\Database\Database;
14 use Friendica\Database\DBStructure;
16 use Friendica\Test\Util\Database\StaticDatabase;
19 * Parent class for test cases requiring fixtures
21 abstract class FixtureTest extends DatabaseTest
27 * Create variables used by tests.
29 protected function setUp()
33 $this->dice = (new Dice())
34 ->addRules(include __DIR__ . '/../static/dependencies.config.php')
35 ->addRule(Database::class, ['instanceOf' => StaticDatabase::class, 'shared' => true])
36 ->addRule(ISession::class, ['instanceOf' => Session\Memory::class, 'shared' => true, 'call' => null]);
37 DI::init($this->dice);
39 /** @var IConfig $config */
40 $configCache = $this->dice->create(Cache::class);
41 $configCache->set('database', 'disable_pdo', true);
43 /** @var Database $dba */
44 $dba = $this->dice->create(Database::class);
46 $dba->setTestmode(true);
48 DBStructure::checkInitialValues();
50 // Load the API dataset for the whole API
51 $this->loadFixture(__DIR__ . '/datasets/api.fixture.php', $dba);