MailMessageFactoryTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 45
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A tearDown() 0 5 1
A testCreationOfMailMessageViaFactory() 0 22 1
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);      
0 ignored issues
show
Bug introduced by
The variable $transport does not exist. Did you forget to declare it?

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.

Loading history...
Bug introduced by
The variable $controller does not exist. Did you forget to declare it?

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.

Loading history...
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);      
0 ignored issues
show
Bug introduced by
The variable $contactForm does not exist. Did you forget to declare it?

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.

Loading history...
54
    }
55
}
56
57