Completed
Push — master ( fd0858...d5ba90 )
by Andrii
29:08 queued 13:19
created

ReadmeTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 39.68 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 5
lcom 1
cbo 1
dl 25
loc 63
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A tearDown() 0 4 1
A testMinimal() 12 12 1
A testMore() 13 13 1
A testDocs() 0 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace base;
13
14
use hidev\tests\functional\Tester;
15
16
class ReadmeTest extends \PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * @var \FunctionalTester
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()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

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.

Loading history...
37
    {
38
        $this->tester->hidev('init the-vendor/new-test-package --norequire --year=2014');
39
        $this->tester->hidev('README.md');
40
        $this->tester->assertFileHas('README.md', [
41
            "New Test Package\n================",
42
            "\n\n## License\n\n",
43
            'This project is released under the terms of the No license',
44
            'Read more [here](http://choosealicense.com/licenses/no-license).',
45
            'Copyright © 2014-' . date('Y') . ', The Vendor',
46
        ]);
47
    }
48
49
    /**
50
     * Test options.
51
     */
52 View Code Duplication
    public function testMore()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

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.

Loading history...
53
    {
54
        $this->tester->hidev('init the-vendor/new-test-package --norequire --headline=Package --license=MIT --year=2014 "--description=The project longer decription"');
55
        $this->tester->hidev('README.md');
56
        $this->tester->assertFileHas('README.md', [
57
            "Package\n=======",
58
            '**New Test Package**',
59
            'The project longer decription',
60
            '## License',
61
            'This project is released under the terms of the MIT [license](LICENSE)',
62
            'Read more [here](http://choosealicense.com/licenses/mit).',
63
        ]);
64
    }
65
66
    /**
67
     * Test docs/readme.
68
     */
69
    public function testDocs()
70
    {
71
        $this->tester->hidev('init the-vendor/new-test-package --norequire --year=2015');
72
        $this->tester->writeFile('docs/readme/Usage.md', "Usage instructions.\nIn multiple lines.");
73
        $this->tester->hidev('README.md');
74
        $this->tester->assertFileHas('README.md', [
75
            "\n\n## Usage\n\nUsage instructions.\nIn multiple lines.\n\n",
76
        ]);
77
    }
78
}
79