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