Skip to content

Commit 83f8c70

Browse files
committed
Some minor fixes to tests
1 parent 51cad64 commit 83f8c70

File tree

2 files changed

+49
-56
lines changed

2 files changed

+49
-56
lines changed

tests/AdminTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AdminTest extends
1818
{
1919
public function setUp()
2020
{
21-
$this->connection = getConnection();
21+
$this->connection = getConnection();
2222
$this->adminHandler = new AdminHandler($this->connection);
2323
}
2424

@@ -40,9 +40,9 @@ public function testGetServerVersionWithDetails()
4040
$result = $this->adminHandler->getServerVersion(true);
4141
$this->assertInternalType('array', $result, "The server version details must be an array!");
4242
$this->assertInternalType(
43-
'array',
44-
$result['details'],
45-
"The server version details must have a `details` array!"
43+
'array',
44+
$result['details'],
45+
"The server version details must have a `details` array!"
4646
);
4747

4848
// intentionally dumping the result, so that we have a bit more info about the Arango build we're testing in the log.
@@ -52,7 +52,7 @@ public function testGetServerVersionWithDetails()
5252
$this->assertArrayHasKey('build-date', $details);
5353
$this->assertArrayHasKey('configure', $details);
5454
$this->assertArrayHasKey('icu-version', $details);
55-
$this->assertArrayHasKey('libev-version', $details);
55+
// $this->assertArrayHasKey('libev-version', $details);
5656
$this->assertArrayHasKey('openssl-version', $details);
5757
$this->assertArrayHasKey('server-version', $details);
5858
$this->assertArrayHasKey('v8-version', $details);

tests/AqlUserFunctionTest.php

Lines changed: 44 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ class AqlUserFunctionTest extends
2525
public function setUp()
2626
{
2727
$this->connection = getConnection();
28-
29-
// clean up first
30-
try {
31-
$this->collectionHandler->delete('ArangoDB_PHP_TestSuite_TestCollection_01');
32-
} catch (\Exception $e) {
33-
// don't bother us, if it's already deleted.
34-
}
3528
}
3629

3730

@@ -54,22 +47,22 @@ public function testRegisterListAndUnregisterAqlUserFunctionWithInitialConfig()
5447
$result = $userFunction->register();
5548

5649
$this->assertTrue(
57-
$result['error'] == false,
58-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
50+
$result['error'] == false,
51+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
5952
);
6053
$list = $userFunction->getRegisteredUserFunctions();
6154

6255
$this->assertCount(1, $list, 'List returned did not return expected 1 attribute');
6356
$this->assertTrue(
64-
$list[0]['name'] == $name && $list[0]['code'] == $code,
65-
'did not return expected Function. Instead returned: ' . $list[0]['name'] . ' and ' . $list[0]['code']
57+
$list[0]['name'] == $name && $list[0]['code'] == $code,
58+
'did not return expected Function. Instead returned: ' . $list[0]['name'] . ' and ' . $list[0]['code']
6659
);
6760

6861
$result = $userFunction->unregister();
6962

7063
$this->assertTrue(
71-
$result['error'] == false,
72-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
64+
$result['error'] == false,
65+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
7366
);
7467
}
7568

@@ -87,22 +80,22 @@ public function testRegisterListAndUnregisterAqlUserFunctionUsingShortcut()
8780
$result = $userFunction->register($name, $code);
8881

8982
$this->assertTrue(
90-
$result['error'] == false,
91-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
83+
$result['error'] == false,
84+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
9285
);
9386
$list = $userFunction->getRegisteredUserFunctions();
9487

9588
$this->assertCount(1, $list, 'List returned did not return expected 1 attribute');
9689
$this->assertTrue(
97-
$list[0]['name'] == $name && $list[0]['code'] == $code,
98-
'did not return expected Function. Instead returned: ' . $list[0]['name'] . ' and ' . $list[0]['code']
90+
$list[0]['name'] == $name && $list[0]['code'] == $code,
91+
'did not return expected Function. Instead returned: ' . $list[0]['name'] . ' and ' . $list[0]['code']
9992
);
10093

10194
$result = $userFunction->unregister($name);
10295

10396
$this->assertTrue(
104-
$result['error'] == false,
105-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
97+
$result['error'] == false,
98+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
10699
);
107100
}
108101

@@ -121,33 +114,33 @@ public function testRegisterListAndUnregisterAqlUserFunctionWithGettersAndSetter
121114
// check if getters work fine
122115

123116
$this->assertTrue(
124-
$userFunction->getName() == $name,
125-
'Did not return name, instead returned: ' . $userFunction->getName()
117+
$userFunction->getName() == $name,
118+
'Did not return name, instead returned: ' . $userFunction->getName()
126119
);
127120
$this->assertTrue(
128-
$userFunction->getCode() == $code,
129-
'Did not return code, instead returned: ' . $userFunction->getCode()
121+
$userFunction->getCode() == $code,
122+
'Did not return code, instead returned: ' . $userFunction->getCode()
130123
);
131124

132125

133126
$result = $userFunction->register();
134127

135128
$this->assertTrue(
136-
$result['error'] == false,
137-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
129+
$result['error'] == false,
130+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
138131
);
139132
$list = $userFunction->getRegisteredUserFunctions();
140133
$this->assertCount(1, $list, 'List returned did not return expected 1 attribute');
141134
$this->assertTrue(
142-
$list[0]['name'] == $name && $list[0]['code'] == $code,
143-
'did not return expected Function. Instead returned: ' . $list[0]['name'] . ' and ' . $list[0]['code']
135+
$list[0]['name'] == $name && $list[0]['code'] == $code,
136+
'did not return expected Function. Instead returned: ' . $list[0]['name'] . ' and ' . $list[0]['code']
144137
);
145138

146139
$result = $userFunction->unregister();
147140

148141
$this->assertTrue(
149-
$result['error'] == false,
150-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
142+
$result['error'] == false,
143+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
151144
);
152145
}
153146

@@ -169,32 +162,32 @@ public function testRegisterListAndUnregisterAqlUserFunctionWithWithMagicSetters
169162

170163
// check if getters work fine
171164
$this->assertTrue(
172-
$userFunction->name == $name,
173-
'Did not return name, instead returned: ' . $userFunction->name
165+
$userFunction->name == $name,
166+
'Did not return name, instead returned: ' . $userFunction->name
174167
);
175168
$this->assertTrue(
176-
$userFunction->code == $code,
177-
'Did not return code, instead returned: ' . $userFunction->code
169+
$userFunction->code == $code,
170+
'Did not return code, instead returned: ' . $userFunction->code
178171
);
179172

180173
$result = $userFunction->register();
181174

182175
$this->assertTrue(
183-
$result['error'] == false,
184-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
176+
$result['error'] == false,
177+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
185178
);
186179
$list = $userFunction->getRegisteredUserFunctions();
187180
$this->assertCount(1, $list, 'List returned did not return expected 1 attribute');
188181
$this->assertTrue(
189-
$list[0]['name'] == $name && $list[0]['code'] == $code,
190-
'did not return expected Function. Instead returned: ' . $list[0]['name'] . ' and ' . $list[0]['code']
182+
$list[0]['name'] == $name && $list[0]['code'] == $code,
183+
'did not return expected Function. Instead returned: ' . $list[0]['name'] . ' and ' . $list[0]['code']
191184
);
192185

193186
$result = $userFunction->unregister();
194187

195188
$this->assertTrue(
196-
$result['error'] == false,
197-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
189+
$result['error'] == false,
190+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
198191
);
199192
}
200193

@@ -218,29 +211,29 @@ public function testReRegisterListAndUnregisterAqlUserFunctionTwice()
218211
$result = $userFunction->register();
219212

220213
$this->assertTrue(
221-
$result['error'] == false,
222-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
214+
$result['error'] == false,
215+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
223216
);
224217

225218
$result = $userFunction->register();
226219

227220
$this->assertTrue(
228-
$result['error'] == false,
229-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
221+
$result['error'] == false,
222+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
230223
);
231224

232225
$list = $userFunction->getRegisteredUserFunctions();
233226
$this->assertCount(1, $list, 'List returned did not return expected 1 attribute');
234227
$this->assertTrue(
235-
$list[0]['name'] == $name && $list[0]['code'] == $code,
236-
'did not return expected Function. Instead returned: ' . $list[0]['name'] . ' and ' . $list[0]['code']
228+
$list[0]['name'] == $name && $list[0]['code'] == $code,
229+
'did not return expected Function. Instead returned: ' . $list[0]['name'] . ' and ' . $list[0]['code']
237230
);
238231

239232
$result = $userFunction->unregister();
240233

241234
$this->assertTrue(
242-
$result['error'] == false,
243-
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
235+
$result['error'] == false,
236+
'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
244237
);
245238

246239
$e = null;
@@ -250,8 +243,8 @@ public function testReRegisterListAndUnregisterAqlUserFunctionTwice()
250243
}
251244

252245
$this->assertTrue(
253-
$e->getCode() == 404,
254-
'Did not return code 404, instead returned: ' . $e->getCode()
246+
$e->getCode() == 404,
247+
'Did not return code 404, instead returned: ' . $e->getCode()
255248
);
256249
}
257250

@@ -263,7 +256,7 @@ public function testGetAQLFunctionsWithNamespaceFilter()
263256

264257
$name1 = 'myFunctions::myFunction';
265258
$name2 = 'myFunctions1::myFunction';
266-
$code = 'function (celsius) { return celsius * 1.8 + 32; }';
259+
$code = 'function (celsius) { return celsius * 1.8 + 32; }';
267260

268261
//Setup
269262
$userFunction = new AqlUserFunction($this->connection);
@@ -298,7 +291,7 @@ public function testUnregisterAQLFunctionsOnNamespace()
298291

299292
$name1 = 'myFunctions::myFunction1';
300293
$name2 = 'myFunctions::myFunction2';
301-
$code = 'function (celsius) { return celsius * 1.8 + 32; }';
294+
$code = 'function (celsius) { return celsius * 1.8 + 32; }';
302295

303296
//Setup
304297
$userFunction = new AqlUserFunction($this->connection);

0 commit comments

Comments
 (0)