Completed
Push — master ( b3b6d3...2114de )
by Andrii
08:18
created

ReadmeTest::prepare()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 1
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
    public $clean = false;
24
25
    protected function setUp()
26
    {
27
        $this->tester = new Tester($this);
28
    }
29
30
    protected function tearDown()
31
    {
32
        $this->tester = null;
33
    }
34
35
    protected function prepare($subdir)
36
    {
37
        $dir = __DIR__ . DIRECTORY_SEPARATOR . $subdir;
38
        $this->tester->setAlias('@hidev/readme', dirname(dirname(__DIR__)) . '/src');
0 ignored issues
show
Bug introduced by
The method setAlias() does not seem to exist on object<hidev\tests\functional\Tester>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
39
        $this->tester->config($dir . '/.hidev/config.yml');
40
41
        return $dir;
42
    }
43
44
    /**
45
     * Test defaults.
46
     */
47
    public function testMinimal()
48
    {
49
        $dir = $this->prepare('minimal');
50
        $this->tester->hidev('README.md');
51
        $this->tester->assertFiles($dir, ['.']);
52
    }
53
54
    /**
55
     * Test options: badges, docs and more.
56
     */
57
    public function testMore()
58
    {
59
        $dir = $this->prepare('more');
60
        $this->tester->writeFile('docs/readme/Usage.md', $dir);
61
        $this->tester->writeFile('docs/readme/Installation.md', $dir);
62
        $this->tester->hidev('README.md');
63
        $this->tester->assertFiles($dir, ['.']);
64
    }
65
}
66