1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* README plugin for HiDev |
5
|
|
|
* |
6
|
|
|
* @link https://github.com/hiqdev/hidev-readme |
7
|
|
|
* @package hidev-readme |
8
|
|
|
* @license BSD-3-Clause |
9
|
|
|
* @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace hidev\readme\tests\functinal; |
13
|
|
|
|
14
|
|
|
use hidev\tests\functional\Tester; |
15
|
|
|
|
16
|
|
|
class ReadmeTest extends \PHPUnit_Framework_TestCase |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var Tester |
20
|
|
|
*/ |
21
|
|
|
protected $tester; |
22
|
|
|
|
23
|
|
|
protected function setUp() |
24
|
|
|
{ |
25
|
|
|
$this->tester = new Tester($this); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
protected function tearDown() |
29
|
|
|
{ |
30
|
|
|
$this->tester = null; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Test minimal. |
35
|
|
|
*/ |
36
|
|
View Code Duplication |
public function testMinimal() |
|
|
|
|
37
|
|
|
{ |
38
|
|
|
$dir = __DIR__ . DIRECTORY_SEPARATOR . 'minimal'; |
39
|
|
|
$this->tester->config($dir . '/.hidev/config.yml'); |
40
|
|
|
$this->tester->hidev('README.md'); |
41
|
|
|
$this->tester->assertFiles($dir, ['.']); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Test options. |
46
|
|
|
*/ |
47
|
|
View Code Duplication |
public function testMore() |
|
|
|
|
48
|
|
|
{ |
49
|
|
|
$dir = __DIR__ . DIRECTORY_SEPARATOR . 'more'; |
50
|
|
|
$this->tester->config($dir . '/.hidev/config.yml'); |
51
|
|
|
$this->tester->hidev('README.md'); |
52
|
|
|
$this->tester->assertFiles($dir, ['.']); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Test docs/readme. |
57
|
|
|
*/ |
58
|
|
|
public function testDocs() |
59
|
|
|
{ |
60
|
|
|
$dir = __DIR__ . DIRECTORY_SEPARATOR . 'docs'; |
61
|
|
|
$this->tester->config($dir . '/.hidev/config.yml'); |
62
|
|
|
$this->tester->writeFile('docs/readme/Usage.md', $dir); |
63
|
|
|
$this->tester->writeFile('docs/readme/Installation.md', $dir); |
64
|
|
|
$this->tester->hidev('README.md'); |
65
|
|
|
$this->tester->assertFiles($dir, ['.']); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
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.