GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (130)

tests/phpunit/Unit/LingoI18NTest.php (2 issues)

1
<?php
2
/**
3
 * This file is part of the MediaWiki extension Lingo.
4
 *
5
 * @copyright 2011 - 2016, 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
 * @ingroup Lingo
35
 * @ingroup Test
36
 */
37
class LingoI18NTest extends \PHPUnit\Framework\TestCase {
0 ignored issues
show
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...
38
39
	public function testJsonSchemaValidatorExists() {
40
		$this->assertTrue( class_exists( '\JsonSchema\Validator' ) );
41
		$this->assertTrue( method_exists( '\JsonSchema\Validator', 'check' ) );
42
	}
43
44
	public function testMagicWordsLoaded() {
45
		// load magic words
46
		require __DIR__ . '/../../../src/Lingo.i18n.magic.php';
47
48
		// assert $magicWords was created
49
		$defined_vars = get_defined_vars();
50
		$this->assertArrayHasKey( 'magicWords', $defined_vars );
51
52
		// validate structure
53
54
		$data = json_decode( json_encode( $defined_vars[ 'magicWords' ] ) );
55
56
		$validator = new \JsonSchema\Validator();
57
		$validator->check( $data, (object)[ '$ref' =>
58
			'file://' . realpath( __DIR__ . '/../Fixture/magicWordsSchema.json' ) ] );
59
60
		// format error message
61
		$errors = implode( '', array_map(
62
			function ( $error ) {
63
				return "* [{$error[ 'property' ]}] {$error[ 'message' ]}\n";
0 ignored issues
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $error instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
64
			},
65
			$validator->getErrors()
66
		) );
67
68
		// assert structure is valid
69
		$this->assertTrue( $validator->isValid(), "JSON does not validate. Violations:\n" . $errors );
70
	}
71
}
72