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.

Code Duplication    Length = 117-119 lines in 2 locations

tests/HSAL/HandlersocketiTest.php 1 location

@@ 5-121 (lines=117) @@
2
3
use HSAL\HSAL;
4
5
class HandlersocketiTest extends PHPUnit_Framework_TestCase
6
{
7
	public function testFetchArray()
8
	{
9
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HANDLERSOCKETI]);
10
11
		$result = $hs->fetchArray('test2', ['id','name','cnt'], [HSAL::INDEX_PRIMARY => 3]);
12
13
		$this->assertTrue(is_array($result));
14
		$this->assertEquals(3, count($result));
15
		$this->assertEquals(3, $result[0]);
16
		$this->assertEquals('page 3', $result[1]);
17
		$this->assertEquals(0, $result[2]);
18
	}
19
20
	public function testFetchAssoc()
21
	{
22
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HANDLERSOCKETI]);
23
24
		$result = $hs->fetchAssoc('test2', ['id','name','cnt'], [HSAL::INDEX_PRIMARY => 3]);
25
26
		$this->assertTrue(is_array($result));
27
		$this->assertEquals(3, count($result));
28
		$this->assertEquals(3, $result['id']);
29
		$this->assertEquals('page 3', $result['name']);
30
		$this->assertEquals(0, $result['cnt']);
31
	}
32
33
	public function testFetchColumn()
34
	{
35
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HANDLERSOCKETI]);
36
37
		$result = $hs->fetchColumn('test2', 'name', [HSAL::INDEX_PRIMARY => 3]);
38
39
		$this->assertEquals('page 3', $result);
40
	}
41
42
	public function testFetchAll()
43
	{
44
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HANDLERSOCKETI]);
45
46
		$result = $hs->fetchAll('test2', ['id', 'name'], [HSAL::INDEX_PRIMARY => 3], HSAL::OPERATOR_LESS_EQUAL);
47
48
		$this->assertTrue(is_array($result));
49
		$this->assertEquals(3, count($result));
50
51
		$this->assertEquals(3, $result[0]['id']);
52
		$this->assertEquals(1, $result[2]['id']);
53
		
54
		$this->assertEquals('page 3', $result[0]['name']);
55
		$this->assertEquals('page 1', $result[2]['name']);
56
	}
57
58
	public function testDelete()
59
	{
60
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HANDLERSOCKETI]);
61
62
		$result = $hs->delete('test2', [HSAL::INDEX_PRIMARY => 3]);
63
64
		$this->assertTrue($result);
65
66
		$result = $hs->delete('test2', [HSAL::INDEX_PRIMARY => 3]);
67
68
		$this->assertFalse($result);
69
	}
70
71
	public function testInsert()
72
	{
73
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HANDLERSOCKETI]);
74
75
		$result = $hs->insert('test2', ['id' => 3, 'name' => 'new page', 'cnt' => 0]);
76
77
		$result = $hs->fetchColumn('test2', 'name', [HSAL::INDEX_PRIMARY => 3]);
78
79
		$this->assertEquals('new page', $result);
80
	}
81
82
	public function testUpdate()
83
	{
84
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HANDLERSOCKETI]);
85
86
		$result = $hs->update('test2', ['name' => 'updated page'], [HSAL::INDEX_PRIMARY => 3]);
87
88
		$this->assertTrue($result);
89
90
		$result = $hs->fetchColumn('test2', 'name', [HSAL::INDEX_PRIMARY => 3]);
91
92
		$this->assertEquals('updated page', $result);
93
	}
94
95
	public function testIncrement()
96
	{
97
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HANDLERSOCKETI]);
98
99
		$result = $hs->increment('test2', 'cnt', [HSAL::INDEX_PRIMARY => 3]);
100
101
		$this->assertTrue($result);
102
103
		$result = $hs->fetchColumn('test2', 'cnt', [HSAL::INDEX_PRIMARY => 3]);
104
105
		$this->assertEquals(1, $result);
106
	}
107
108
	public function testDecrement()
109
	{
110
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HANDLERSOCKETI]);
111
112
		$result = $hs->decrement('test2', 'cnt', [HSAL::INDEX_PRIMARY => 3]);
113
114
		$this->assertTrue($result);
115
116
		$result = $hs->fetchColumn('test2', 'cnt', [HSAL::INDEX_PRIMARY => 3]);
117
118
		$this->assertEquals(0, $result);
119
	}
120
121
}
122

tests/HSAL/HSPHPTest.php 1 location

@@ 5-123 (lines=119) @@
2
3
use HSAL\HSAL;
4
5
class HSPHPTest extends PHPUnit_Framework_TestCase
6
{
7
	public function testFetchArray()
8
	{
9
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HSPHP]);
10
11
		$result = $hs->fetchArray('test', ['id','name','cnt'], [HSAL::INDEX_PRIMARY => 3]);
12
13
		$this->assertTrue(is_array($result));
14
		$this->assertEquals(3, count($result));
15
		$this->assertEquals(3, $result[0]);
16
		$this->assertEquals('page 3', $result[1]);
17
		$this->assertEquals(0, $result[2]);
18
	}
19
20
	public function testFetchAssoc()
21
	{
22
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HSPHP]);
23
24
		$result = $hs->fetchAssoc('test', ['id','name','cnt'], [HSAL::INDEX_PRIMARY => 3]);
25
26
		$this->assertTrue(is_array($result));
27
		$this->assertEquals(3, count($result));
28
		$this->assertEquals(3, $result['id']);
29
		$this->assertEquals('page 3', $result['name']);
30
		$this->assertEquals(0, $result['cnt']);
31
	}
32
33
	public function testFetchColumn()
34
	{
35
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HSPHP]);
36
37
		$result = $hs->fetchColumn('test', 'name', [HSAL::INDEX_PRIMARY => 3]);
38
39
		$this->assertEquals('page 3', $result);
40
	}
41
42
	public function testFetchAll()
43
	{
44
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HSPHP]);
45
46
		$result = $hs->fetchAll('test', ['id', 'name'], [HSAL::INDEX_PRIMARY => 3], HSAL::OPERATOR_LESS_EQUAL);
47
48
		$this->assertTrue(is_array($result));
49
		$this->assertEquals(3, count($result));
50
51
		$this->assertEquals(3, $result[0]['id']);
52
		$this->assertEquals(1, $result[2]['id']);
53
		
54
		$this->assertEquals('page 3', $result[0]['name']);
55
		$this->assertEquals('page 1', $result[2]['name']);
56
	}
57
58
	public function testDelete()
59
	{
60
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HSPHP]);
61
62
		$result = $hs->delete('test', [HSAL::INDEX_PRIMARY => 3]);
63
64
		$this->assertTrue($result);
65
66
		$result = $hs->delete('test', [HSAL::INDEX_PRIMARY => 3]);
67
68
		$this->assertFalse($result);
69
	}
70
71
	public function testInsert()
72
	{
73
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HSPHP]);
74
75
		$result = $hs->insert('test', ['id' => 3, 'name' => 'new page', 'cnt' => 0]);
76
77
		$this->assertTrue($result);
78
79
		$result = $hs->fetchColumn('test', 'name', [HSAL::INDEX_PRIMARY => 3]);
80
81
		$this->assertEquals('new page', $result);
82
	}
83
84
	public function testUpdate()
85
	{
86
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HSPHP]);
87
88
		$result = $hs->update('test', ['name' => 'updated page'], [HSAL::INDEX_PRIMARY => 3]);
89
90
		$this->assertTrue($result);
91
92
		$result = $hs->fetchColumn('test', 'name', [HSAL::INDEX_PRIMARY => 3]);
93
94
		$this->assertEquals('updated page', $result);
95
	}
96
97
	public function testIncrement()
98
	{
99
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HSPHP]);
100
101
		$result = $hs->increment('test', 'cnt', [HSAL::INDEX_PRIMARY => 3]);
102
103
		$this->assertTrue($result);
104
105
		$result = $hs->fetchColumn('test', 'cnt', [HSAL::INDEX_PRIMARY => 3]);
106
107
		$this->assertEquals(1, $result);
108
	}
109
110
	public function testDecrement()
111
	{
112
		$hs = new HSAL('localhost', 'hstest', ['driver' => HSAL::DRIVER_HSPHP]);
113
114
		$result = $hs->decrement('test', 'cnt', [HSAL::INDEX_PRIMARY => 3]);
115
116
		$this->assertTrue($result);
117
118
		$result = $hs->fetchColumn('test', 'cnt', [HSAL::INDEX_PRIMARY => 3]);
119
120
		$this->assertEquals(0, $result);
121
	}
122
123
}
124