1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Org_Heigl\ContactTest\Service; |
4
|
|
|
|
5
|
|
|
use Org_Heigl\Contact\Service\ContactControllerFactory; |
6
|
|
|
use Zend\ServiceManager\ServiceManager; |
7
|
|
|
use PHPUnit\Framework\TestCase; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* test case. |
11
|
|
|
*/ |
12
|
|
|
class ContactControllerFactoryTest extends TestCase |
13
|
|
|
{ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Prepares the environment before running a test. |
17
|
|
|
*/ |
18
|
|
|
protected function setUp() |
19
|
|
|
{ |
20
|
|
|
parent::setUp(); |
21
|
|
|
|
22
|
|
|
// TODO Auto-generated ContactControllerFactoryTest::setUp() |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Cleans up the environment after running a test. |
27
|
|
|
*/ |
28
|
|
|
protected function tearDown() |
29
|
|
|
{ |
30
|
|
|
// TODO Auto-generated ContactControllerFactoryTest::tearDown() |
31
|
|
|
parent::tearDown(); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function testCreationOfContactControllerViaFactory() |
35
|
|
|
{ |
36
|
|
|
$this->markTestSkipped('Some More testing has to be done here'); |
37
|
|
|
$contactForm = $this->getMock('\OrgHeiglContact\Form\ContactForm'); |
|
|
|
|
38
|
|
|
$transport = $this->getMock('\Zend\Mail\Transport\TransportInterface'); |
|
|
|
|
39
|
|
|
$message = $this->getMock('\Zend\Mail\Message'); |
|
|
|
|
40
|
|
|
$serviceLocator = new ServiceManager(); |
41
|
|
|
$serviceLocator->setFactory('message', '\OrgHeiglContact\Services\MailMessageFactory', false); |
|
|
|
|
42
|
|
|
$serviceLocator->setFactory('transport', '\OrgHeiglContact\Services\MailTransportFactory', false); |
|
|
|
|
43
|
|
|
$serviceLocator->setInvokableClass('OrgHeiglContact\Form\ContactForm', 'OrgHeiglContact\Form\ContactForm', false); |
|
|
|
|
44
|
|
|
$serviceManager = new ServiceLocator(); |
|
|
|
|
45
|
|
|
$factory = new ContactControllerFactory(); |
46
|
|
|
$controller = $factory->createService($serviceLocator); |
|
|
|
|
47
|
|
|
$this->assertInstanceOf('\OrgHeiglContact\Controller\ContactController', $controller); |
48
|
|
|
$this->assertAttributeInstanceOf('\Zend\Mail\Transport\TransportInterface', 'transport', $controller); |
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 calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.