Skip to content

Commit

Permalink
Remove PurgeDatabaseTrait usage
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 committed Jan 27, 2025
1 parent 12ff104 commit 32a1e80
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 52 deletions.
4 changes: 2 additions & 2 deletions tests/Application/src/Tests/Controller/BlogPostApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
use Sylius\Bundle\ResourceBundle\ResourceBundleInterface;
use Symfony\Component\HttpFoundation\Response;
use Tests\ApiTestCase;
use Tests\PurgeDatabaseTrait;
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;

final class BlogPostApiTest extends ApiTestCase
{
use Factories;
use PurgeDatabaseTrait;
use ResetDatabase;

#[Test]
public function it_allows_creating_a_blog_post(): void
Expand Down
12 changes: 8 additions & 4 deletions tests/Application/src/Tests/Controller/BookApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\HttpFoundation\Response;
use Tests\ApiTestCase;
use Tests\PurgeDatabaseTrait;
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;

class BookApiTest extends ApiTestCase
{
use Factories;
use PurgeDatabaseTrait;
use ResetDatabase;

#[Test]
public function it_allows_creating_a_book(): void
Expand Down Expand Up @@ -132,8 +132,7 @@ public function it_allows_removing_a_book(): void
$this->assertResponseIsSuccessful();
$this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);

$deletedBook = $this->getContainer()->get('app.repository.book')->find($bookId);
$this->assertNull($deletedBook);
$this->assertEquals(0, $this->getContainer()->get('app.repository.book')->count([]));
}

#[Test]
Expand Down Expand Up @@ -668,4 +667,9 @@ private function markAsSkippedIfNecessary(): void
$this->markTestSkipped();
}
}

public function assert()
{
return $this->assertEquals();
}
}
4 changes: 2 additions & 2 deletions tests/Application/src/Tests/Controller/ComicBookApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\HttpFoundation\Response;
use Tests\ApiTestCase;
use Tests\PurgeDatabaseTrait;
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;

final class ComicBookApiTest extends ApiTestCase
{
use Factories;
use PurgeDatabaseTrait;
use ResetDatabase;

#[Test]
public function it_allows_creating_a_comic_book(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Application/src/Tests/Controller/GedmoApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\HttpFoundation\Response;
use Tests\ApiTestCase;
use Tests\PurgeDatabaseTrait;
use Zenstruck\Foundry\Test\ResetDatabase;

final class GedmoApiTest extends ApiTestCase
{
use PurgeDatabaseTrait;
use ResetDatabase;

#[Test]
public function it_allows_creating_a_comic_book(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/Application/src/Tests/Controller/PullRequestApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\HttpFoundation\Response;
use Tests\ApiTestCase;
use Tests\PurgeDatabaseTrait;
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;

final class PullRequestApiTest extends ApiTestCase
{
use Factories;
use PurgeDatabaseTrait;
use ResetDatabase;

#[Test]
public function it_allows_creating_a_pull_request(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\HttpFoundation\Response;
use Tests\ApiTestCase;
use Tests\PurgeDatabaseTrait;
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;

final class SubscriptionJsonApiTest extends ApiTestCase
{
use Factories;
use PurgeDatabaseTrait;
use ResetDatabase;

#[Test]
public function it_allows_showing_a_subscription(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\HttpFoundation\Response;
use Tests\ApiTestCase;
use Tests\PurgeDatabaseTrait;
use Zenstruck\Foundry\Test\Factories;
use Zenstruck\Foundry\Test\ResetDatabase;

final class SubscriptionXmlApiTest extends ApiTestCase
{
use Factories;
use PurgeDatabaseTrait;
use ResetDatabase;

private static array $headersWithContentType = [
'CONTENT_TYPE' => 'application/xml',
Expand Down
36 changes: 0 additions & 36 deletions tests/PurgeDatabaseTrait.php

This file was deleted.

0 comments on commit 32a1e80

Please sign in to comment.