1 | <?php |
||
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 |