Passed
Pull Request — master (#1312)
by Michael
06:53
created

AbstractHelperTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Xmf\Test\Module\Helper;
6
7
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Xmf\Module\Helper\AbstractHelper;
9
10
require_once dirname(__DIR__, 5) . '/init_new.php';
11
12
class AbstractHelperTest extends TestCase
13
{
14
    /**
15
     * @var AbstractHelper
16
     */
17
    protected $object;
18
19
    /**
20
     * Sets up the fixture, for example, opens a network connection.
21
     * This method is called before a test is executed.
22
     */
23
    protected function setUp(): void
24
    {
25
        //$this->object = new \Xmf\Module\Helper\AbstractHelper;
26
        $this->object = $this->getMockForAbstractClass(AbstractHelper::class);
27
        //$this->object->expects($this->any())
28
        //    ->method('getDefaultParams')
29
        //    ->will($this->returnValue(array()));
30
    }
31
32
    /**
33
     * Tears down the fixture, for example, closes a network connection.
34
     * This method is called after a test is executed.
35
     */
36
    protected function tearDown(): void
37
    {
38
    }
39
40
    public function testSetDebug()
41
    {
42
        //TODO change $debug in AbstractHelper from protected to public, otherwise assertEquals() won't work
43
44
        $this->assertTrue(method_exists($this->object, 'setDebug'));
45
        $this->object->setDebug(true);
46
//        $this->assertAttributeEquals(true, 'debug', $this->object);
47
        $this->assertEquals(true, $this->object->debug);
48
        $this->object->setDebug(false);
49
//        $this->assertAttributeEquals(false, 'debug', $this->object);
50
        $this->assertEquals(false, $this->object->debug);
51
    }
52
53
    public function testAddLog()
54
    {
55
        $this->assertTrue(method_exists($this->object, 'addLog'));
56
        $this->object->addLog('message to send to bitbucket');
57
    }
58
}
59