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

ReadmeTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 50
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A tearDown() 0 4 1
A prepare() 0 8 1
A testMinimal() 0 6 1
A testMore() 0 8 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