b08ac3c0a7
- Introduce own Yaml-to-SQL class - Introduce new way of MySQL-DB-tests (per rollback) - Remove dependency phpunit/dbunit - Introduce new dev-dependency for YAML-ready (Symfony YAML reader)
33 lines
693 B
PHP
33 lines
693 B
PHP
<?php
|
|
/**
|
|
* DatabaseTest class.
|
|
*/
|
|
|
|
namespace Friendica\Test;
|
|
|
|
use Friendica\Test\Util\Database\StaticDatabase;
|
|
|
|
/**
|
|
* Abstract class used by tests that need a database.
|
|
*/
|
|
abstract class DatabaseTest extends MockedTest
|
|
{
|
|
protected function setUp()
|
|
{
|
|
parent::setUp();
|
|
|
|
StaticDatabase::statConnect($_SERVER);
|
|
// Rollbacks every DB usage (in case the test couldn't call tearDown)
|
|
StaticDatabase::statRollback();
|
|
// Start the first, outer transaction
|
|
StaticDatabase::getGlobConnection()->beginTransaction();
|
|
}
|
|
|
|
protected function tearDown()
|
|
{
|
|
// Rollbacks every DB usage so we don't commit anything into the DB
|
|
StaticDatabase::statRollback();
|
|
|
|
parent::tearDown();
|
|
}
|
|
}
|