Skip to content

Commit

Permalink
[TesterBundle] Remove ServiceTesterTrait fix #268
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoiriert committed May 21, 2024
1 parent 2d330bf commit aa82471
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 76 deletions.
8 changes: 0 additions & 8 deletions packages/tester-bundle/.phpstorm.meta.php

This file was deleted.

48 changes: 0 additions & 48 deletions packages/tester-bundle/DependencyInjection/ServiceTesterTrait.php

This file was deleted.

8 changes: 0 additions & 8 deletions packages/tester-bundle/DrawTesterBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@

class DrawTesterBundle extends Bundle
{
public static $ids = [];

public static function addServicesToTest($ids): void
{
$ids = (array) $ids;
self::$ids += $ids;
}

public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new CompilerPass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class TransportTesterTest extends TestCase

protected function setUp(): void
{
$this->transportTester = $this->getService('messenger.transport.memory.draw.tester');
$this->transportTester = static::getContainer()->get('messenger.transport.memory.draw.tester');
}

public function testGetTransport(): void
{
static::assertSame(
$this->getService('messenger.transport.memory'),
static::getContainer()->get('messenger.transport.memory'),
$this->transportTester->getTransport()
);
}
Expand Down
2 changes: 0 additions & 2 deletions packages/tester-bundle/Tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Draw\Bundle\TesterBundle\Tests;

use Draw\Bundle\TesterBundle\DependencyInjection\ServiceTesterTrait;
use Draw\Bundle\TesterBundle\Http\BrowserFactoryInterface;
use Draw\Bundle\TesterBundle\Http\HttpTesterTrait;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
Expand All @@ -11,7 +10,6 @@
class TestCase extends KernelTestCase implements BrowserFactoryInterface
{
use HttpTesterTrait;
use ServiceTesterTrait;

// For symfony 4.x
protected static $class = AppKernel::class;
Expand Down
14 changes: 8 additions & 6 deletions tests/Controller/Api/UsersControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
use Doctrine\ORM\EntityManagerInterface;
use Draw\Bundle\UserBundle\Email\ForgotPasswordEmail;
use Monolog\Level;
use PHPUnit\Framework\Attributes\AfterClass;
use PHPUnit\Framework\Attributes\BeforeClass;
use Symfony\Component\HttpFoundation\Response;

class UsersControllerTest extends TestCase
{
/**
* @beforeClass
*
* @afterClass
*/
#[
BeforeClass,
AfterClass,
]
public static function cleanUp(): void
{
static::getService(EntityManagerInterface::class)
static::getContainer()
->get(EntityManagerInterface::class)
->createQueryBuilder()
->delete(User::class, 'user')
->andWhere('user.email = :email')
Expand Down
2 changes: 0 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Tests;

use Draw\Bundle\TesterBundle\DependencyInjection\ServiceTesterTrait;
use Draw\Bundle\TesterBundle\Http\BrowserFactoryInterface;
use Draw\Bundle\TesterBundle\Http\HttpTesterTrait;
use Draw\Bundle\TesterBundle\Mailer\TemplatedMailerAssertionsTrait;
Expand All @@ -21,7 +20,6 @@ class TestCase extends KernelTestCase implements BrowserFactoryInterface
}
use MessengerTesterTrait;
use MetricTesterTrait;
use ServiceTesterTrait;
use TemplatedMailerAssertionsTrait;

public function createBrowser(): AbstractBrowser
Expand Down

0 comments on commit aa82471

Please sign in to comment.