1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the MediaWiki extension Lingo. |
4
|
|
|
* |
5
|
|
|
* @copyright 2011 - 2017, Stephan Gambke |
6
|
|
|
* @license GPL-2.0-or-later |
7
|
|
|
* |
8
|
|
|
* The Lingo extension is free software: you can redistribute it and/or modify |
9
|
|
|
* it under the terms of the GNU General Public License as published by the Free |
10
|
|
|
* Software Foundation; either version 2 of the License, or (at your option) any |
11
|
|
|
* later version. |
12
|
|
|
* |
13
|
|
|
* The Lingo extension is distributed in the hope that it will be useful, but |
14
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
15
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
16
|
|
|
* details. |
17
|
|
|
* |
18
|
|
|
* You should have received a copy of the GNU General Public License along |
19
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>. |
20
|
|
|
* |
21
|
|
|
* @author Stephan Gambke |
22
|
|
|
* @since 2.0 |
23
|
|
|
* @file |
24
|
|
|
* @ingroup Lingo |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
namespace Lingo\Tests\Unit; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @group extensions-lingo |
31
|
|
|
* @group extensions-lingo-unit |
32
|
|
|
* @group mediawiki-databaseless |
33
|
|
|
* |
34
|
|
|
* @coversDefaultClass \Lingo\Backend |
35
|
|
|
* @covers ::<private> |
36
|
|
|
* @covers ::<protected> |
37
|
|
|
* |
38
|
|
|
* @ingroup Lingo |
39
|
|
|
* @ingroup Test |
40
|
|
|
*/ |
41
|
|
|
class BackendTest extends \PHPUnit\Framework\TestCase { |
|
|
|
|
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @covers ::__construct |
45
|
|
|
* @covers ::getMessageLog |
46
|
|
|
*/ |
47
|
|
|
public function testGetMessageLog_withLogGivenToConstructor() { |
48
|
|
|
$log = $this->getMockBuilder( '\Lingo\MessageLog' ) |
49
|
|
|
->getMock(); |
50
|
|
|
|
51
|
|
|
$stub = $this->getMockBuilder( '\Lingo\Backend' ) |
52
|
|
|
->disableOriginalConstructor() |
53
|
|
|
->getMockForAbstractClass(); |
54
|
|
|
|
55
|
|
|
$reflected = new \ReflectionClass( '\Lingo\Backend' ); |
56
|
|
|
$constructor = $reflected->getConstructor(); |
57
|
|
|
$constructor->invokeArgs( $stub, [ &$log ] ); |
58
|
|
|
|
59
|
|
|
$this->assertEquals( $log, $stub->getMessageLog() ); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @covers ::__construct |
64
|
|
|
* @covers ::getMessageLog |
65
|
|
|
*/ |
66
|
|
|
public function testGetMessageLog_withoutLogGivenToConstructor() { |
67
|
|
|
$stub = $this->getMockBuilder( '\Lingo\Backend' ) |
68
|
|
|
->disableOriginalConstructor() |
69
|
|
|
->getMockForAbstractClass(); |
70
|
|
|
|
71
|
|
|
$reflected = new \ReflectionClass( '\Lingo\Backend' ); |
72
|
|
|
$constructor = $reflected->getConstructor(); |
73
|
|
|
$constructor->invoke( $stub ); |
74
|
|
|
|
75
|
|
|
$this->assertInstanceOf( '\Lingo\MessageLog', $stub->getMessageLog() ); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @covers ::useCache |
80
|
|
|
*/ |
81
|
|
|
public function testUseCache() { |
82
|
|
|
$stub = $this->getMockForAbstractClass( '\Lingo\Backend' ); |
83
|
|
|
|
84
|
|
|
$this->assertFalse( $stub->useCache() ); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @covers ::setLingoParser |
89
|
|
|
* @covers ::getLingoParser |
90
|
|
|
*/ |
91
|
|
|
public function testSetGetLingoParser() { |
92
|
|
|
$stub = $this->getMockForAbstractClass( '\Lingo\Backend' ); |
93
|
|
|
$parserMock = $this->getMockBuilder( '\Lingo\LingoParser' ) |
94
|
|
|
->getMock(); |
95
|
|
|
|
96
|
|
|
$stub->setLingoParser( $parserMock ); |
97
|
|
|
$this->assertEquals( $parserMock, $stub->getLingoParser() ); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @covers ::setLingoParser |
102
|
|
|
* @covers ::getLingoParser |
103
|
|
|
*/ |
104
|
|
|
public function testGetLingoParser_withoutParserGiven() { |
105
|
|
|
$stub = $this->getMockForAbstractClass( '\Lingo\Backend' ); |
106
|
|
|
$this->assertInstanceOf( '\Lingo\LingoParser', $stub->getLingoParser() ); |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|
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