Completed
Push — master ( 586166...fecb59 )
by Paweł
47:58
created

HtmlWidgetTest::tearDown()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.2
c 0
b 0
f 0
cc 4
eloc 6
nc 3
nop 0
1
<?php
2
3
/**
4
 * This file is part of the Superdesk Web Publisher Templates System.
5
 *
6
 * Copyright 2015 Sourcefabric z.ú. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2015 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Component\TemplatesSystem\Tests\Gimme\Container;
16
17
use SWP\Component\TemplatesSystem\Gimme\Widget\HtmlWidgetHandler;
18
use SWP\Component\TemplatesSystem\Tests\Gimme\Model\WidgetModel;
19
20
class HtmlWidgetTest extends \PHPUnit_Framework_TestCase
21
{
22
    private $widget;
23
24
    public function setUp()
25
    {
26
        $widgetEntity = new WidgetModel();
27
        $widgetEntity->setId(1);
28
        $widgetEntity->setParameters(['html_body' => 'simple html body']);
29
30
        $this->widget = new HtmlWidgetHandler($widgetEntity);
31
    }
32
33
    public function testCheckingVisibility()
34
    {
35
        $this->assertTrue($this->widget->isVisible());
36
    }
37
38
    public function testRendering()
39
    {
40
        $this->assertEquals($this->widget->render(), 'simple html body');
41
    }
42
43
    protected function tearDown()
44
    {
45
        $reflection = new \ReflectionObject($this);
46
        foreach ($reflection->getProperties() as $prop) {
47
            if (!$prop->isStatic() && 0 !== strpos($prop->getDeclaringClass()->getName(), 'PHPUnit_')) {
0 ignored issues
show
introduced by
Consider using $prop->class. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
48
                $prop->setAccessible(true);
49
                $prop->setValue($this, null);
50
            }
51
        }
52
    }
53
}
54