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
Push — master ( a16ac0...33e1e8 )
by Der Mundschenk
15s
created

Trie_Node_Test   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 126
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 126
rs 10
c 1
b 0
f 0
wmc 7
lcom 1
cbo 2
1
<?php
2
/**
3
 *  This file is part of PHP-Typography.
4
 *
5
 *  Copyright 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  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\Hyphenator;
26
27
use \PHP_Typography\Tests\PHP_Typography_Testcase;
28
use \PHP_Typography\Hyphenator\Trie_Node;
29
30
/**
31
 * Trie_Node unit test.
32
 *
33
 * @coversDefaultClass \PHP_Typography\Hyphenator\Trie_Node
34
 * @usesDefaultClass \PHP_Typography\Hyphenator\Trie_Node
35
 */
36
class Trie_Node_Test extends PHP_Typography_Testcase {
37
38
	/**
39
	 * Sets up the fixture, for example, opens a network connection.
40
	 * This method is called before a test is executed.
41
	 */
42
	protected function setUp() { // @codingStandardsIgnoreLine
43
	}
44
45
	/**
46
	 * Tears down the fixture, for example, closes a network connection.
47
	 * This method is called after a test is executed.
48
	 */
49
	protected function tearDown() { // @codingStandardsIgnoreLine
50
	}
51
52
53
54
	/**
55
	 * Tests build_trie.
56
	 *
57
	 * @covers ::build_trie
58
	 * @covers ::__construct
59
	 *
60
	 * @uses ::get_node
61
	 * @uses PHP_Typography\Strings::mb_str_split
62
	 *
63
	 * @return Trie_Node
64
	 */
65
	public function test_build_trie() {
66
		$trie = Trie_Node::build_trie( [
67
			'_aba'  => '00010',
68
			'_abl'  => '00030',
69
			'_abo'  => '00002',
70
			'_abol' => '000300',
71
			'_abor' => '000100',
72
			'_abs'  => '00032',
73
			'_abu'  => '00030',
74
			'_aden' => '000030',
75
		] );
76
77
		$this->assertInstanceOf( Trie_Node::class, $trie );
78
79
		return $trie;
80
	}
81
82
	/**
83
	 * Test exists.
84
	 *
85
	 * @covers ::exists
86
	 * @depends test_build_trie
87
88
	 * @param  Trie_Node $trie A trie.
89
	 *
90
	 * @return Trie_Node
91
	 */
92
	public function test_exists( Trie_Node $trie ) {
93
		$this->assertTrue( $trie->exists( '_' ) );
94
		$this->assertFalse( $trie->exists( 'foobar' ) );
95
96
		return $trie;
97
	}
98
99
	/**
100
	 * Test get_node.
101
	 *
102
	 * @covers ::get_node
103
	 * @depends test_build_trie
104
	 *
105
	 * @param  Trie_Node $trie A trie.
106
	 *
107
	 * @return Trie_Node
108
	 */
109
	public function test_get_node( Trie_Node $trie ) {
110
		$node = $trie->get_node( '_' );
111
112
		$this->assertInstanceOf( Trie_Node::class, $node );
113
114
		return $trie;
115
	}
116
117
	/**
118
	 * Test get_node.
119
	 *
120
	 * @covers ::get_node
121
	 * @depends test_get_node
122
	 *
123
	 * @uses ::__construct
124
	 *
125
	 * @param  Trie_Node $trie A trie.
126
	 *
127
	 * @return Trie_Node
128
	 */
129
	public function test_get_node_new( Trie_Node $trie ) {
130
		$node = $trie->get_node( '*' );
131
132
		$this->assertInstanceOf( Trie_Node::class, $node );
133
134
		return $trie;
135
	}
136
137
	/**
138
	 * Test offsets.
139
	 *
140
	 * @covers ::offsets
141
	 * @depends test_build_trie
142
	 *
143
	 * @uses ::get_node
144
	 *
145
	 * @param  Trie_Node $trie A trie.
146
	 *
147
	 * @return Trie_Node
148
	 */
149
	public function test_offsets( Trie_Node $trie ) {
150
		$node = $trie->get_node( '_' );
151
		$node = $node->get_node( 'a' );
152
		$node = $node->get_node( 'b' );
153
		$node = $node->get_node( 'a' );
154
155
		$this->assertInstanceOf( Trie_Node::class, $node );
156
		$this->assertInternalType( 'array', $node->offsets() );
157
		$this->assertGreaterThan( 0, count( $node->offsets() ) );
158
159
		return $trie;
160
	}
161
}
162