Skip to content

Commit e6f59bd

Browse files
committed
Rename Fixtures to Helper and use testCamelCase naming convention
1 parent 46944b6 commit e6f59bd

File tree

13 files changed

+46
-96
lines changed

13 files changed

+46
-96
lines changed

tests/Functional/DefaultSenderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace Sylius\Bundle\MailerBundle\Tests\Functional;
1515

16-
use Sylius\Bundle\MailerBundle\Tests\Fixtures\MessagesProvider;
17-
use Sylius\Bundle\MailerBundle\Tests\Fixtures\SentMessagesPurger;
16+
use Sylius\Bundle\MailerBundle\Tests\Helper\MessagesProvider;
17+
use Sylius\Bundle\MailerBundle\Tests\Helper\SentMessagesPurger;
1818
use Sylius\Component\Mailer\Sender\SenderInterface;
1919
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
2020
use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace Sylius\Bundle\MailerBundle\Tests\Fixtures;
14+
namespace Sylius\Bundle\MailerBundle\Tests\Helper;
1515

1616
use Symfony\Component\Finder\Finder;
1717
use Symfony\Component\Finder\SplFileInfo;
1818
use Symfony\Component\Mime\Email;
1919

20-
final class MessagesProvider
20+
final readonly class MessagesProvider
2121
{
22-
public function __construct(private readonly string $spoolDirectory)
22+
public function __construct(private string $spoolDirectory)
2323
{
2424
}
2525

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace Sylius\Bundle\MailerBundle\Tests\Fixtures;
14+
namespace Sylius\Bundle\MailerBundle\Tests\Helper;
1515

1616
use Symfony\Component\Mime\Email;
1717

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
declare(strict_types=1);
1313

14-
namespace Sylius\Bundle\MailerBundle\Tests\Fixtures;
14+
namespace Sylius\Bundle\MailerBundle\Tests\Helper;
1515

1616
final class SentMessagesPurger
1717
{

tests/Unit/Bundle/Renderer/Adapter/EmailDefaultAdapterTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Sylius\Bundle\MailerBundle\Tests\Unit\Bundle\Renderer\Adapter;
1515

16-
use PHPUnit\Framework\Attributes\Test;
1716
use PHPUnit\Framework\TestCase;
1817
use Sylius\Bundle\MailerBundle\Renderer\Adapter\EmailDefaultAdapter;
1918
use Sylius\Bundle\MailerBundle\Renderer\Adapter\EmailTwigAdapter;
@@ -29,14 +28,12 @@ protected function setUp(): void
2928
$this->adapter = new EmailDefaultAdapter();
3029
}
3130

32-
#[Test]
33-
public function it_is_an_adapter(): void
31+
public function testIsAnAdapter(): void
3432
{
3533
$this->assertInstanceOf(AbstractAdapter::class, $this->adapter);
3634
}
3735

38-
#[Test]
39-
public function it_throws_an_exception_about_not_configured_email_renderer_adapter(): void
36+
public function testThrowsExceptionAboutNotConfiguredEmailRendererAdapter(): void
4037
{
4138
$this->expectException(\RuntimeException::class);
4239
$this->expectExceptionMessage(sprintf(

tests/Unit/Bundle/Renderer/Adapter/EmailTwigAdapterTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313

1414
namespace Sylius\Bundle\MailerBundle\Tests\Unit\Bundle\Renderer\Adapter;
1515

16-
use PHPUnit\Framework\Attributes\Test;
1716
use PHPUnit\Framework\MockObject\MockObject;
1817
use PHPUnit\Framework\TestCase;
1918
use Sylius\Bundle\MailerBundle\Renderer\Adapter\EmailTwigAdapter;
2019
use Sylius\Component\Mailer\Event\EmailRenderEvent;
2120
use Sylius\Component\Mailer\Model\Email;
22-
use Sylius\Component\Mailer\Model\EmailInterface;
2321
use Sylius\Component\Mailer\Renderer\Adapter\AbstractAdapter;
2422
use Sylius\Component\Mailer\Renderer\RenderedEmail;
2523
use Sylius\Component\Mailer\SyliusMailerEvents;
@@ -42,14 +40,12 @@ protected function setUp(): void
4240
$this->adapter = new EmailTwigAdapter($this->twig, $this->dispatcher);
4341
}
4442

45-
#[Test]
46-
public function it_is_an_adapter(): void
43+
public function testIsAnAdapter(): void
4744
{
4845
$this->assertInstanceOf(AbstractAdapter::class, $this->adapter);
4946
}
5047

51-
#[Test]
52-
public function it_creates_and_renders_an_email_without_template(): void
48+
public function testCreatesAndRendersEmailWithoutTemplate(): void
5349
{
5450
$email = new Email();
5551
$email->setSubject('Hello {{ name }}');
@@ -73,8 +69,7 @@ public function it_creates_and_renders_an_email_without_template(): void
7369
$this->assertInstanceOf(RenderedEmail::class, $result);
7470
}
7571

76-
#[Test]
77-
public function it_renders_an_email_with_template(): void
72+
public function testRendersEmailWithTemplate(): void
7873
{
7974
$twig = new Environment(new ArrayLoader([
8075
'MyTemplate' => '{% block subject %}Test Subject{% endblock %}{% block body %}Test Body{% endblock %}',

tests/Unit/Bundle/Sender/Adapter/DefaultAdapterTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Sylius\Bundle\MailerBundle\Tests\Unit\Bundle\Sender\Adapter;
1515

16-
use PHPUnit\Framework\Attributes\Test;
1716
use PHPUnit\Framework\TestCase;
1817
use Sylius\Bundle\MailerBundle\Sender\Adapter\DefaultAdapter;
1918
use Sylius\Bundle\MailerBundle\Sender\Adapter\SymfonyMailerAdapter;
@@ -30,14 +29,12 @@ protected function setUp(): void
3029
$this->adapter = new DefaultAdapter();
3130
}
3231

33-
#[Test]
34-
public function it_is_an_adapter(): void
32+
public function testIsAnAdapter(): void
3533
{
3634
$this->assertInstanceOf(AbstractAdapter::class, $this->adapter);
3735
}
3836

39-
#[Test]
40-
public function it_throws_an_exception_about_not_configured_email_sender_adapter_for_send(): void
37+
public function testThrowsExceptionAboutNotConfiguredEmailSenderAdapterForSend(): void
4138
{
4239
$this->expectException(\RuntimeException::class);
4340
$this->expectExceptionMessage(sprintf(
@@ -55,8 +52,7 @@ public function it_throws_an_exception_about_not_configured_email_sender_adapter
5552
);
5653
}
5754

58-
#[Test]
59-
public function it_throws_an_exception_about_not_configured_email_sender_adapter_for_send_with_cc(): void
55+
public function testThrowsExceptionAboutNotConfiguredEmailSenderAdapterForSendWithCc(): void
6056
{
6157
$this->expectException(\RuntimeException::class);
6258
$this->expectExceptionMessage(sprintf(

tests/Unit/Bundle/Sender/Adapter/SymfonyMailerAdapterTest.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Sylius\Bundle\MailerBundle\Tests\Unit\Bundle\Sender\Adapter;
1515

16-
use PHPUnit\Framework\Attributes\Test;
1716
use PHPUnit\Framework\MockObject\MockObject;
1817
use PHPUnit\Framework\TestCase;
1918
use Sylius\Bundle\MailerBundle\Sender\Adapter\SymfonyMailerAdapter;
@@ -22,11 +21,11 @@
2221
use Sylius\Component\Mailer\Renderer\RenderedEmail;
2322
use Sylius\Component\Mailer\Sender\Adapter\AbstractAdapter;
2423
use Sylius\Component\Mailer\SyliusMailerEvents;
24+
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2525
use Symfony\Component\Mailer\Exception\TransportException;
2626
use Symfony\Component\Mailer\MailerInterface;
2727
use Symfony\Component\Mime\Address;
2828
use Symfony\Component\Mime\Email as MimeEmail;
29-
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
3029

3130
final class SymfonyMailerAdapterTest extends TestCase
3231
{
@@ -43,14 +42,12 @@ protected function setUp(): void
4342
$this->adapter = new SymfonyMailerAdapter($this->mailer);
4443
}
4544

46-
#[Test]
47-
public function it_is_an_adapter(): void
45+
public function testIsAnAdapter(): void
4846
{
4947
$this->assertInstanceOf(AbstractAdapter::class, $this->adapter);
5048
}
5149

52-
#[Test]
53-
public function it_sends_an_email_with_events(): void
50+
public function testSendsEmailWithEvents(): void
5451
{
5552
$this->adapter->setEventDispatcher($this->dispatcher);
5653

@@ -89,8 +86,7 @@ public function it_sends_an_email_with_events(): void
8986
);
9087
}
9188

92-
#[Test]
93-
public function it_sends_an_email_with_cc_and_bcc(): void
89+
public function testSendsEmailWithCcAndBcc(): void
9490
{
9591
$renderedEmail = new RenderedEmail('subject', 'body');
9692
$email = new Email();
@@ -121,8 +117,7 @@ public function it_sends_an_email_with_cc_and_bcc(): void
121117
);
122118
}
123119

124-
#[Test]
125-
public function it_sends_an_email_with_attachments(): void
120+
public function testSendsEmailWithAttachments(): void
126121
{
127122
$renderedEmail = new RenderedEmail('subject', 'body');
128123
$email = new Email();
@@ -142,8 +137,7 @@ public function it_sends_an_email_with_attachments(): void
142137
);
143138
}
144139

145-
#[Test]
146-
public function it_does_not_handle_exceptions_from_the_mailer(): void
140+
public function testDoesNotHandleExceptionsFromTheMailer(): void
147141
{
148142
$renderedEmail = new RenderedEmail('subject', 'body');
149143
$email = new Email();

tests/Unit/Component/Factory/EmailFactoryTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Sylius\Bundle\MailerBundle\Tests\Unit\Component\Factory;
1515

16-
use PHPUnit\Framework\Attributes\Test;
1716
use PHPUnit\Framework\TestCase;
1817
use Sylius\Component\Mailer\Factory\EmailFactory;
1918
use Sylius\Component\Mailer\Factory\EmailFactoryInterface;
@@ -28,14 +27,12 @@ protected function setUp(): void
2827
$this->factory = new EmailFactory();
2928
}
3029

31-
#[Test]
32-
public function it_implements_email_factory_interface(): void
30+
public function testImplementsEmailFactoryInterface(): void
3331
{
3432
$this->assertInstanceOf(EmailFactoryInterface::class, $this->factory);
3533
}
3634

37-
#[Test]
38-
public function it_creates_new_email(): void
35+
public function testCreatesNewEmail(): void
3936
{
4037
$email = $this->factory->createNew();
4138

tests/Unit/Component/Model/EmailTest.php

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Sylius\Bundle\MailerBundle\Tests\Unit\Component\Model;
1515

16-
use PHPUnit\Framework\Attributes\Test;
1716
use PHPUnit\Framework\TestCase;
1817
use Sylius\Component\Mailer\Model\Email;
1918
use Sylius\Component\Mailer\Model\EmailInterface;
@@ -27,74 +26,64 @@ protected function setUp(): void
2726
$this->email = new Email();
2827
}
2928

30-
#[Test]
31-
public function it_implements_email_interface(): void
29+
public function testImplementsEmailInterface(): void
3230
{
3331
$this->assertInstanceOf(EmailInterface::class, $this->email);
3432
}
3533

36-
#[Test]
37-
public function it_has_no_code_by_default(): void
34+
public function testHasNoCodeByDefault(): void
3835
{
3936
$this->assertNull($this->email->getCode());
4037
}
4138

42-
#[Test]
43-
public function its_code_is_mutable(): void
39+
public function testCodeIsMutable(): void
4440
{
4541
$this->email->setCode('bar');
4642

4743
$this->assertSame('bar', $this->email->getCode());
4844
}
4945

50-
#[Test]
51-
public function its_subject_is_mutable(): void
46+
public function testSubjectIsMutable(): void
5247
{
5348
$this->email->setSubject('foo');
5449

5550
$this->assertSame('foo', $this->email->getSubject());
5651
}
5752

58-
#[Test]
59-
public function its_content_is_mutable(): void
53+
public function testContentIsMutable(): void
6054
{
6155
$this->email->setContent('foo content');
6256

6357
$this->assertSame('foo content', $this->email->getContent());
6458
}
6559

66-
#[Test]
67-
public function its_template_is_mutable(): void
60+
public function testTemplateIsMutable(): void
6861
{
6962
$this->email->setTemplate('template.html.twig');
7063

7164
$this->assertSame('template.html.twig', $this->email->getTemplate());
7265
}
7366

74-
#[Test]
75-
public function its_sender_name_is_mutable(): void
67+
public function testSenderNameIsMutable(): void
7668
{
7769
$this->email->setSenderName('Example');
7870

7971
$this->assertSame('Example', $this->email->getSenderName());
8072
}
8173

82-
#[Test]
83-
public function its_sender_address_is_mutable(): void
74+
public function testSenderAddressIsMutable(): void
8475
{
8576
$this->email->setSenderAddress('no-reply@example.com');
8677

8778
$this->assertSame('no-reply@example.com', $this->email->getSenderAddress());
8879
}
8980

90-
#[Test]
91-
public function it_is_enabled_by_default(): void
81+
public function testIsEnabledByDefault(): void
9282
{
9383
$this->assertTrue($this->email->isEnabled());
9484
}
9585

96-
#[Test]
97-
public function it_can_be_disabled(): void
86+
public function testCanBeDisabled(): void
9887
{
9988
$this->email->setEnabled(false);
10089

0 commit comments

Comments
 (0)