1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Org_Heigl\ContactTest\Service; |
4
|
|
|
|
5
|
|
|
use Zend\Mail\Message; |
6
|
|
|
use PHPUnit\Framework\TestCase; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* test case. |
10
|
|
|
*/ |
11
|
|
|
class MailMessageFactoryTest extends TestCase |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Prepares the environment before running a test. |
16
|
|
|
*/ |
17
|
|
|
protected function setUp() |
18
|
|
|
{ |
19
|
|
|
parent::setUp(); |
20
|
|
|
|
21
|
|
|
// TODO Auto-generated ContactControllerFactoryTest::setUp() |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Cleans up the environment after running a test. |
26
|
|
|
*/ |
27
|
|
|
protected function tearDown() |
28
|
|
|
{ |
29
|
|
|
// TODO Auto-generated ContactControllerFactoryTest::tearDown() |
30
|
|
|
parent::tearDown(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function testCreationOfMailMessageViaFactory() |
34
|
|
|
{ |
35
|
|
|
$this->markTestSkipped('Some More testing has to be done here'); |
36
|
|
|
$mailconfig = array( |
37
|
|
|
'OrgHeiglContact' => array( |
38
|
|
|
'message' => array( |
39
|
|
|
'from' => '[email protected]', |
40
|
|
|
) |
41
|
|
|
) |
42
|
|
|
); |
43
|
|
|
$serviceLocator = new ServiceLocator(); |
44
|
|
|
$serviceLocator->set('config', array()); |
45
|
|
|
$factory = new MailMessageFactory(); |
46
|
|
|
$message = $factory->createService($serviceLocator); |
47
|
|
|
$this->assertInstanceOf('\Zend\Mail\message', $message); |
48
|
|
|
$this->assertEquals($mailconfig['from'], $message->getFrom()); |
49
|
|
|
$this->assertAttributeEquals($transport, 'transport', $controller); |
|
|
|
|
50
|
|
|
$this->assertAttributeInstanceOf('\Zend\Mail\Message', 'message', $controller); |
51
|
|
|
$this->assertAttributeEquals($message, 'message', $controller); |
52
|
|
|
$this->assertAttributeInstanceOf('\OrgHeiglContact\Form\ContactForm', 'form', $controller); |
53
|
|
|
$this->assertAttributeEquals($contactForm, 'form', $controller); |
|
|
|
|
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
|
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.