GeneratorTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testExceptionForIncompatibleAnnotations() 0 6 1
A testExceptionIfManyDestinationUsed() 0 11 1
A testGenerationEchoValueEqualsReturnValue() 0 15 1
1
<?php
2
3
/*
4
 * This file is part of the Bukashk0zzzYmlGenerator
5
 *
6
 * (c) Denis Golubovskiy <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Bukashk0zzz\YmlGenerator\Tests;
13
14
use Bukashk0zzz\YmlGenerator\Generator;
15
use Bukashk0zzz\YmlGenerator\Model\ShopInfo;
16
use Bukashk0zzz\YmlGenerator\Settings;
17
18
/**
19
 * Generator test
20
 */
21
class GeneratorTest extends \PHPUnit_Framework_TestCase
22
{
23
    /**
24
     * @expectedException \RuntimeException
25
     */
26
    public function testExceptionForIncompatibleAnnotations()
27
    {
28
        (new Generator((new Settings())->setOutputFile('')))
29
            ->generate(new ShopInfo(), [], [], [])
30
        ;
31
    }
32
33
    /**
34
     * @expectedException \LogicException
35
     */
36
    public function testExceptionIfManyDestinationUsed()
37
    {
38
        $settings = (new Settings())
39
            ->setOutputFile('')
40
            ->setReturnResultYMLString(true)
41
        ;
42
43
        (new Generator($settings))
44
            ->generate(new ShopInfo(), [], [], [])
45
        ;
46
    }
47
48
    /**
49
     * Test equal returned value and printed
50
     */
51
    public function testGenerationEchoValueEqualsReturnValue()
52
    {
53
        $settings = (new Settings())
54
            ->setReturnResultYMLString(true)
55
        ;
56
        $value = (new Generator($settings))
57
            ->generate(new ShopInfo(), [], [], [], []);
58
59
        \ob_start();
60
        (new Generator(new Settings()))
61
            ->generate(new ShopInfo(), [], [], [], []);
62
        $value2 = \ob_get_clean();
63
64
        $this->assertEquals($value, $value2);
65
    }
66
}
67