|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
//namespace Xoops\Tests\Database; |
|
6
|
|
|
|
|
7
|
|
|
use PHPUnit\Framework\TestCase; |
|
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
require_once dirname(__DIR__) . '/init_new.php'; |
|
10
|
|
|
|
|
11
|
|
|
require_once(XOOPS_TU_ROOT_PATH . '/class/logger/xoopslogger.php'); |
|
12
|
|
|
require_once(XOOPS_TU_ROOT_PATH . '/class/xoopsload.php'); |
|
13
|
|
|
require_once(XOOPS_TU_ROOT_PATH . '/class/preload.php'); |
|
14
|
|
|
require_once(XOOPS_TU_ROOT_PATH . '/class/database/databasefactory.php'); |
|
15
|
|
|
|
|
16
|
|
|
require_once(XOOPS_TU_ROOT_PATH . '/kernel/object.php'); |
|
17
|
|
|
|
|
18
|
|
|
class XoopsPersistableObjectHandlerTestInstance extends \XoopsPersistableObjectHandler |
|
19
|
|
|
{ |
|
20
|
|
|
// allow access to the protected function in abstract class |
|
21
|
|
|
public function __construct( |
|
22
|
|
|
\XoopsDatabase $db, |
|
23
|
|
|
$table = '', |
|
24
|
|
|
$className = '', |
|
25
|
|
|
$keyName = '', |
|
26
|
|
|
$identifierName = '' |
|
27
|
|
|
) { |
|
28
|
|
|
parent::__construct($db, $table, $className, $keyName, $identifierName); |
|
29
|
|
|
} |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
class XoopsPersistableObjectHandlerTest extends TestCase |
|
33
|
|
|
{ |
|
34
|
|
|
protected $myclass = 'XoopsPersistableObjectHandlerTestInstance'; |
|
35
|
|
|
|
|
36
|
|
|
public function test___publicProperties() |
|
37
|
|
|
{ |
|
38
|
|
|
$items = ['db']; |
|
39
|
|
|
foreach ($items as $item) { |
|
40
|
|
|
try { |
|
41
|
|
|
$prop = new ReflectionProperty($this->myclass, $item); |
|
42
|
|
|
} catch (ReflectionException $e) { |
|
|
|
|
|
|
43
|
|
|
} |
|
44
|
|
|
$this->assertTrue($prop->isPublic()); |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function test___construct() |
|
49
|
|
|
{ |
|
50
|
|
|
$conn = \XoopsDatabaseFactory::getDatabaseConnection(); |
|
51
|
|
|
$table = 'table'; |
|
52
|
|
|
$className = 'className'; |
|
53
|
|
|
$keyName = 'keyName'; |
|
54
|
|
|
$identifierName = 'identifierName'; |
|
55
|
|
|
$instance = new $this->myclass($conn, $table, $className, $keyName, $identifierName); |
|
56
|
|
|
$this->assertInstanceOf($this->myclass, $instance); |
|
57
|
|
|
$this->assertInstanceOf(\XoopsPersistableObjectHandler::class, $instance); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths