Passed
Pull Request — master (#1312)
by Michael
08:36 queued 02:22
created

GenericHelperTest::testIsUserAdmin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
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\GenericHelper;
9
10
require_once dirname(__DIR__, 5) . '/init_new.php';
11
12
require_once(XOOPS_TU_ROOT_PATH . '/include/functions.php');
13
require_once(XOOPS_TU_ROOT_PATH . '/kernel/object.php');
14
15
require_once(XOOPS_TU_ROOT_PATH . '/class/logger/xoopslogger.php');
16
require_once(XOOPS_TU_ROOT_PATH . '/class/xoopsload.php');
17
require_once(XOOPS_TU_ROOT_PATH . '/class/preload.php');
18
require_once(XOOPS_TU_ROOT_PATH . '/class/database/databasefactory.php');
19
require_once(XOOPS_TU_ROOT_PATH . '/class/module.textsanitizer.php');
20
21
class GenericHelperTestHelper extends GenericHelper
22
{
23
    public static function getHelper($dirname = 'system')
24
    {
25
        $instance = new static($dirname);
26
        return $instance;
27
    }
28
}
29
30
if (!function_exists('xoops_getHandler')) {
31
    function xoops_getHandler($name, $optional = false)
32
    {
33
        $handler = \Xoops\Core\Handler\Factory::newSpec()
0 ignored issues
show
Bug introduced by
The type Xoops\Core\Handler\Factory 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...
34
                                              ->scheme('kernel')
35
                                              ->name($name)
36
                                              ->optional((bool)$optional)
37
                                              ->build();
38
        return $handler;
39
    }
40
}
41
42
class GenericHelperTest extends TestCase
43
{
44
    /**
45
     * @var GenericHelper
46
     */
47
    protected $object;
48
49
    /**
50
     * Sets up the fixture, for example, opens a network connection.
51
     * This method is called before a test is executed.
52
     */
53
    protected function setUp(): void
54
    {
55
        $this->object = GenericHelperTestHelper::getHelper();
56
    }
57
58
    /**
59
     * Tears down the fixture, for example, closes a network connection.
60
     * This method is called after a test is executed.
61
     */
62
    protected function tearDown(): void
63
    {
64
    }
65
66
    public function testGetModule()
67
    {
68
        // Remove the following lines when you implement this test.
69
        $this->markTestIncomplete(
70
            'This test has not been implemented yet.'
71
        );
72
    }
73
74
    public function testGetConfig()
75
    {
76
        // Remove the following lines when you implement this test.
77
        $this->markTestIncomplete(
78
            'This test has not been implemented yet.'
79
        );
80
    }
81
82
    public function testGetHandler()
83
    {
84
        // Remove the following lines when you implement this test.
85
        $this->markTestIncomplete(
86
            'This test has not been implemented yet.'
87
        );
88
    }
89
90
    public function testLoadLanguage()
91
    {
92
        // Remove the following lines when you implement this test.
93
        $this->markTestIncomplete(
94
            'This test has not been implemented yet.'
95
        );
96
    }
97
98
    public function testSetDebug()
99
    {
100
        // Remove the following lines when you implement this test.
101
        $this->markTestIncomplete(
102
            'This test has not been implemented yet.'
103
        );
104
    }
105
106
    public function testAddLog()
107
    {
108
        // Remove the following lines when you implement this test.
109
        $this->markTestIncomplete(
110
            'This test has not been implemented yet.'
111
        );
112
    }
113
114
    public function testIsCurrentModule()
115
    {
116
        // Remove the following lines when you implement this test.
117
        $this->markTestIncomplete(
118
            'This test has not been implemented yet.'
119
        );
120
    }
121
122
    public function testIsUserAdmin()
123
    {
124
        include_once XOOPS_ROOT_PATH . '/kernel/user.php';
125
        $GLOBALS['xoopsUser'] = '';
126
        $this->assertFalse($this->object->isUserAdmin());
127
128
        $GLOBALS['xoopsUser'] = new \XoopsUser();
129
        $this->assertFalse($this->object->isUserAdmin());
130
    }
131
132
    public function testUrl()
133
    {
134
        // Remove the following lines when you implement this test.
135
        $this->markTestIncomplete(
136
            'This test has not been implemented yet.'
137
        );
138
    }
139
140
    public function testPath()
141
    {
142
        // Remove the following lines when you implement this test.
143
        $this->markTestIncomplete(
144
            'This test has not been implemented yet.'
145
        );
146
    }
147
148
    public function testRedirect()
149
    {
150
        // Remove the following lines when you implement this test.
151
        $this->markTestIncomplete(
152
            'This test has not been implemented yet.'
153
        );
154
    }
155
}
156