-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathParameterApplicationTest.php
More file actions
54 lines (45 loc) · 1.43 KB
/
Copy pathParameterApplicationTest.php
File metadata and controls
54 lines (45 loc) · 1.43 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
52
53
54
<?php
namespace DesignPatterns\Creational\FactoryMethod\Test;
use DesignPatterns\Creational\FactoryMethod\ParameterApplication\ParameterApplication;
use DesignPatterns\Creational\FactoryMethod\ParameterApplication\ParameterRequest;
use DesignPatterns\Creational\FactoryMethod\ParameterApplication\ParameterRouter;
/**
* @author Vlad Riabchenko <contact@vria.eu>
*/
class ParameterApplicationTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ParameterApplication
*/
private $application;
protected function setUp()
{
$this->application = new ParameterApplication();
}
public function testRouterClass()
{
$this->assertInstanceOf(ParameterRouter::class, $this->application->createRouter());
}
public function testRequestClass()
{
$this->assertInstanceOf(ParameterRequest::class, $this->application->createRequest('/url'));
}
public function testUserAction()
{
$this->assertEquals('<h1>Showing user #123</h1>', $this->application->handle('/user?id=123'));
}
public function testArticlesAction()
{
$this->assertEquals(
'<h1>Showing articles of home category with filter table</h1>',
$this->application->handle('/articles?category=home&filter=table')
);
}
/**
* @expectedException \Exception
*/
public function testException()
{
$this->application->handle('/404');
}
}