1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: device |
5
|
|
|
* Date: 18.03.16 |
6
|
|
|
* Time: 18:34 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace AppBundle\Tests\Controller\Admin; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
use AppBundle\Tests\TestBaseWeb; |
13
|
|
|
|
14
|
|
View Code Duplication |
class ModuleControllerTest extends TestBaseWeb |
|
|
|
|
15
|
|
|
{ |
16
|
|
|
public function testCreateModule() |
17
|
|
|
{ |
18
|
|
|
$client = static::createClient(array(), array( |
19
|
|
|
'PHP_AUTH_USER' => '[email protected]', |
20
|
|
|
'PHP_AUTH_PW' => 'user', |
21
|
|
|
)); |
22
|
|
|
$client->request('GET', '/admin/module/new'); |
23
|
|
|
$this->assertEquals(200, $client->getResponse()->getStatusCode()); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function testEditModule() |
27
|
|
|
{ |
28
|
|
|
$client = static::createClient(array(), array( |
29
|
|
|
'PHP_AUTH_USER' => '[email protected]', |
30
|
|
|
'PHP_AUTH_PW' => 'user', |
31
|
|
|
)); |
32
|
|
|
$client->request('GET', '/admin/module/edit/1'); |
33
|
|
|
$this->assertEquals(200, $client->getResponse()->getStatusCode()); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function testRemoveModule() |
37
|
|
|
{ |
38
|
|
|
$client = static::createClient(array(), array( |
39
|
|
|
'PHP_AUTH_USER' => '[email protected]', |
40
|
|
|
'PHP_AUTH_PW' => 'user', |
41
|
|
|
)); |
42
|
|
|
$client->request('DELETE', '/admin/module/remove/1'); |
43
|
|
|
$this->assertEquals(302, $client->getResponse()->getStatusCode()); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function testShowModule() |
47
|
|
|
{ |
48
|
|
|
$client = static::createClient(array(), array( |
49
|
|
|
'PHP_AUTH_USER' => '[email protected]', |
50
|
|
|
'PHP_AUTH_PW' => 'user', |
51
|
|
|
)); |
52
|
|
|
$client->request('GET', '/admin/module'); |
53
|
|
|
$this->assertEquals(200, $client->getResponse()->getStatusCode()); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.