Passed
Push — master ( 1f914d...5ffc4b )
by Aimeos
12:32
created

SymfonyTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 14
c 1
b 0
f 0
dl 0
loc 33
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 12 2
A testSend() 0 5 1
A testCreate() 0 4 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2023
6
 */
7
8
9
namespace Aimeos\Base\Mail;
10
11
12
class SymfonyTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $mailer;
15
	private $mock;
16
17
18
	protected function setUp() : void
19
	{
20
		if( !class_exists( 'Symfony\Component\Mailer\MailerInterface' ) ) {
21
			$this->markTestSkipped( 'Class Symfony\Component\Mailer\MailerInterface not found' );
22
		}
23
24
		$mock = $this->getMockBuilder( 'Symfony\Component\Mailer\MailerInterface' )
25
			->disableOriginalConstructor()
26
			->getMock();
27
28
		$this->mailer = new \Aimeos\Base\Mail\Symfony( function() use ( $mock ) { return $mock; } );
29
		$this->mock = $mock;
30
	}
31
32
33
	public function testCreate()
34
	{
35
		$result = $this->mailer->create( 'ISO-8859-1' );
36
		$this->assertInstanceOf( '\\Aimeos\\Base\\Mail\\Message\\Iface', $result );
37
	}
38
39
40
	public function testSend()
41
	{
42
		$this->mock->expects( $this->once() )->method( 'send' );
43
44
		$this->mailer->send( $this->mailer->create() );
45
	}
46
47
}
48