-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSimpleApplicationTest.php
More file actions
51 lines (42 loc) · 1.31 KB
/
Copy pathSimpleApplicationTest.php
File metadata and controls
51 lines (42 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace DesignPatterns\Creational\FactoryMethod\Test;
use DesignPatterns\Creational\FactoryMethod\RequestInterface;
use DesignPatterns\Creational\FactoryMethod\SimpleApplication\SimpleApplication;
use DesignPatterns\Creational\FactoryMethod\SimpleApplication\SimpleRouter;
/**
* @author Vlad Riabchenko <contact@vria.eu>
*/
class SimpleApplicationTest extends \PHPUnit_Framework_TestCase
{
/**
* @var SimpleApplication
*/
private $application;
protected function setUp()
{
$this->application = new SimpleApplication();
}
public function testRouterClass()
{
$this->assertInstanceOf(SimpleRouter::class, $this->application->createRouter());
}
public function testRequestClass()
{
$this->assertInstanceOf(RequestInterface::class,$this->application->createRequest('/url'));
}
public function testIndexAction()
{
$this->assertEquals('<h1>Simple App greats you!</h1>', $this->application->handle('/'));
}
public function testContactAction()
{
$this->assertEquals('<h1>We will be pleased to hear from you!</h1>', $this->application->handle('/contact.html'));
}
/**
* @expectedException \Exception
*/
public function testException()
{
$this->application->handle('/404');
}
}