Skip to content

Commit

Permalink
tec: Improve database reset performance
Browse files Browse the repository at this point in the history
Change the reset strategy by a rollbacked transaction, now implemented
directly in Minz.
  • Loading branch information
marienfressinaud committed Sep 19, 2024
1 parent 736a087 commit 585f087
Show file tree
Hide file tree
Showing 78 changed files with 184 additions and 233 deletions.
2 changes: 1 addition & 1 deletion lib/Minz
4 changes: 2 additions & 2 deletions tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

class ApplicationTest extends \PHPUnit\Framework\TestCase
{
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\LoginHelper;
use \Minz\Tests\ResponseAsserts;

public function testRunSetsTheDefaultLocale(): void
{
Expand Down
49 changes: 0 additions & 49 deletions tests/InitializerHelper.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/auth/CurrentUserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

class CurrentUserTest extends \PHPUnit\Framework\TestCase
{
use \Minz\Tests\InitializerHelper;
use \tests\FakerHelper;
use \tests\InitializerHelper;

#[\PHPUnit\Framework\Attributes\Before]
public function resetCurrentUser(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class ApplicationTest extends \PHPUnit\Framework\TestCase
{
use \tests\InitializerHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;

public function testRunDoesntFail(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/FeatureFlagsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

class FeatureFlagsTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;

#[\PHPUnit\Framework\Attributes\BeforeClass]
public static function loadApplication(): void
Expand Down
6 changes: 3 additions & 3 deletions tests/cli/FeedsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

class FeedsTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\MockHttpHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\MockHttpHelper;

#[\PHPUnit\Framework\Attributes\BeforeClass]
public static function loadApplication(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/MediaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

class MediaTest extends \PHPUnit\Framework\TestCase
{
use \tests\InitializerHelper;
use \tests\MockHttpHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\MockHttpHelper;

#[\PHPUnit\Framework\Attributes\BeforeClass]
public static function loadApplication(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/SystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

class SystemTest extends \PHPUnit\Framework\TestCase
{
use \tests\InitializerHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;

#[\PHPUnit\Framework\Attributes\BeforeClass]
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/TopicsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

class TopicsTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;

#[\PHPUnit\Framework\Attributes\BeforeClass]
public static function loadApplication(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/UrlsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

class UrlsTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\MockHttpHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\MockHttpHelper;

#[\PHPUnit\Framework\Attributes\BeforeClass]
public static function loadApplication(): void
Expand Down
6 changes: 3 additions & 3 deletions tests/cli/UsersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

class UsersTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\MockHttpHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \Minz\Tests\TimeHelper;
use \tests\FakerHelper;
use \tests\MockHttpHelper;

#[\PHPUnit\Framework\Attributes\BeforeClass]
public static function loadApplication(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/controllers/AssetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

class AssetsTest extends \PHPUnit\Framework\TestCase
{
use \tests\InitializerHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;

public function testShowReturnsTheAsset(): void
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/BookmarksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

class BookmarksTest extends \PHPUnit\Framework\TestCase
{
use \tests\LoginHelper;
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\LoginHelper;

public function testIndexRendersCorrectly(): void
{
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/CollectionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

class CollectionsTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\LoginHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\LoginHelper;

public function testIndexRedirectsToLinks(): void
{
Expand Down
4 changes: 2 additions & 2 deletions tests/controllers/DiscoveryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

class DiscoveryTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;

public function testShowRendersCorrectly(): void
{
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/ExportationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

class ExportationsTest extends \PHPUnit\Framework\TestCase
{
use \tests\LoginHelper;
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\LoginHelper;

#[\PHPUnit\Framework\Attributes\BeforeClass]
public static function setJobAdapterToDatabase(): void
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/FeedsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

class FeedsTest extends \PHPUnit\Framework\TestCase
{
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\LoginHelper;
use \tests\MockHttpHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\ResponseAsserts;

#[\PHPUnit\Framework\Attributes\Before]
public function emptyCachePath(): void
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/GroupsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

class GroupsTest extends \PHPUnit\Framework\TestCase
{
use \tests\LoginHelper;
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\LoginHelper;

public function testEditRendersCorrectly(): void
{
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/ImportationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

class ImportationsTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\LoginHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\LoginHelper;

public function testDeleteDeletesImportationAndRedirects(): void
{
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/LinksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

class LinksTest extends \PHPUnit\Framework\TestCase
{
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\LoginHelper;
use \tests\MockHttpHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\ResponseAsserts;

#[\PHPUnit\Framework\Attributes\Before]
public function emptyCachePath(): void
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/MastodonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

class MastodonTest extends \PHPUnit\Framework\TestCase
{
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\LoginHelper;
use \tests\MockHttpHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\ResponseAsserts;

public function testShowRendersCorrectly(): void
{
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/MessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

class MessagesTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\LoginHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\LoginHelper;

public function testEditRendersCorrectly(): void
{
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/NewsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

class NewsTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\LoginHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\LoginHelper;

public function testIndexRendersNewsLinksCorrectly(): void
{
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/OnboardingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

class OnboardingTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\LoginHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\LoginHelper;

public function testShowRendersCorrectly(): void
{
Expand Down
6 changes: 3 additions & 3 deletions tests/controllers/PagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

class PagesTest extends \PHPUnit\Framework\TestCase
{
use \tests\FakerHelper;
use \tests\InitializerHelper;
use \tests\LoginHelper;
use \Minz\Tests\ApplicationHelper;
use \Minz\Tests\InitializerHelper;
use \Minz\Tests\ResponseAsserts;
use \tests\FakerHelper;
use \tests\LoginHelper;

public function testHomeRedirectsToLoginIfNotConnected(): void
{
Expand Down
Loading

0 comments on commit 585f087

Please sign in to comment.