Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

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.
Completed
Pull Request — master (#15)
by Der Mundschenk
02:23
created

RE_Test   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 0
loc 63
rs 10
c 1
b 1
f 0
wmc 5
lcom 1
cbo 1
1
<?php
2
/**
3
 *  This file is part of PHP-Typography.
4
 *
5
 *  Copyright 2015-2017 Peter Putzer.
6
 *
7
 *  This program is free software; you can redistribute it and/or
8
 *  modify it under the terms of the GNU General Public License
9
 *  as published by the Free Software Foundation; either version 2
10
 *  of the License, or ( at your option ) any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program; if not, write to the Free Software
19
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
 *
21
 *  @package mundschenk-at/php-typography/tests
22
 *  @license http://www.gnu.org/licenses/gpl-2.0.html
23
 */
24
25
namespace PHP_Typography\Tests;
26
27
use \PHP_Typography\RE;
28
29
/**
30
 * RE unit test.
31
 *
32
 * @coversDefaultClass \PHP_Typography\RE
33
 * @usesDefaultClass \PHP_Typography\RE
34
 */
35
class RE_Test extends PHP_Typography_Testcase {
36
37
	/**
38
	 * Sets up the fixture, for example, opens a network connection.
39
	 * This method is called before a test is executed.
40
	 */
41
	protected function setUp() { // @codingStandardsIgnoreLine
42
	}
43
44
	/**
45
	 * Tears down the fixture, for example, closes a network connection.
46
	 * This method is called after a test is executed.
47
	 */
48
	protected function tearDown() { // @codingStandardsIgnoreLine
49
	}
50
51
	/**
52
	 * Tests top_level_domains.
53
	 *
54
	 * @covers ::top_level_domains
55
	 *
56
	 * @uses ::get_top_level_domains_from_file
57
	 */
58
	public function test_top_level_domains() {
59
		$result = $this->invokeStaticMethod( RE::class, 'top_level_domains', [] );
60
61
		$this->assertInternalType( 'string', $result, 'RE::top_level_domains() should return a string.' );
62
		$this->assertGreaterThan( 0, strlen( $result ) );
63
	}
64
65
	/**
66
	 * Tests top_level_domains.
67
	 *
68
	 * @covers ::top_level_domains
69
	 *
70
	 * @uses ::get_top_level_domains_from_file
71
	 */
72
	public function test_top_level_domains_clean() {
73
		// Unset RE::$top_level_domains_pattern.
74
		$this->setStaticValue( RE::class, 'top_level_domains_pattern', null );
75
76
		$result = $this->invokeStaticMethod( RE::class, 'top_level_domains', [] );
77
78
		$this->assertInternalType( 'string', $result, 'RE::top_level_domains() should return a string.' );
79
		$this->assertGreaterThan( 0, strlen( $result ) );
80
	}
81
82
	/**
83
	 * Tests get_top_level_domains_from_file.
84
	 *
85
	 * @covers ::get_top_level_domains_from_file
86
	 */
87
	public function test_get_top_level_domains_from_file() {
88
		$default = 'ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|com|coop|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw';
89
90
		$invalid_result = $this->invokeStaticMethod( RE::class, 'get_top_level_domains_from_file', [ '/some/invalid/path/to_a_non_existent_file.txt' ] );
91
		$valid_result   = $this->invokeStaticMethod( RE::class, 'get_top_level_domains_from_file', [ dirname( __DIR__ ) . '/src/IANA/tlds-alpha-by-domain.txt' ] );
92
93
		$this->assertSame( $default, $invalid_result );
94
		$this->assertNotSame( $valid_result, $invalid_result );
95
		$this->assertNotEmpty( $valid_result );
96
	}
97
}
98