Skip to content

Commit f36c05c

Browse files
author
Chris Park
committed
CS cleanup of test
1 parent f3e9ea5 commit f36c05c

File tree

1 file changed

+30
-39
lines changed

1 file changed

+30
-39
lines changed

tests/rosette/api/ApiTest.php

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
function curl_exec($ch)
3131
{
3232
$data = array ('response'=>'{"content": "Mocked response content"}');
33-
return '{"content": "Mocked response content"}';
33+
return '{"content": "Mocked response content"}';
3434
}
3535

3636
function curl_getinfo($ch)
@@ -232,43 +232,34 @@ public function testEndpoints($filename, $endpoint)
232232
// If it does not throw an exception, check that it was not supposed to and if so check that it
233233
// returns the correct thing.
234234
// If it throws an exception, check that it was supposed to and if so pass otherwise fail test.
235-
//try {
236-
$result = '';
237-
if ($endpoint === 'categories') {
238-
$result = $api->categories($params);
239-
}
240-
if ($endpoint === 'entities') {
241-
$result = $api->entities($params);
242-
}
243-
if ($endpoint === 'entities_linked') {
244-
$result = $api->entities($params, true);
245-
}
246-
if ($endpoint === 'language') {
247-
$result = $api->language($params);
248-
}
249-
if ($endpoint === 'name-similarity') {
250-
$result = $api->nameSimilarity($params);
251-
}
252-
if ($endpoint === 'morphology_complete') {
253-
$result = $api->morphology($params);
254-
}
255-
if ($endpoint === 'sentiment') {
256-
$result = $api->sentiment($params);
257-
}
258-
if ($endpoint === 'name-translation') {
259-
$result = $api->nameTranslation($params);
260-
}
261-
if ($endpoint === 'relationships') {
262-
$result = $api->relationships($params);
263-
}
264-
// If there is a "code" key, it means an exception should be thrown
265-
//if (!array_key_exists('code', $expected)) {
266-
$this->assertEquals($expected, $result[0]);
267-
268-
//}
269-
//} catch (RosetteException $exception) {
270-
// $this->assertSame('unsupportedLanguage', $expected['code']);
271-
//}
235+
$result = '';
236+
if ($endpoint === 'categories') {
237+
$result = $api->categories($params);
238+
}
239+
if ($endpoint === 'entities') {
240+
$result = $api->entities($params);
241+
}
242+
if ($endpoint === 'entities_linked') {
243+
$result = $api->entities($params, true);
244+
}
245+
if ($endpoint === 'language') {
246+
$result = $api->language($params);
247+
}
248+
if ($endpoint === 'name-similarity') {
249+
$result = $api->nameSimilarity($params);
250+
}
251+
if ($endpoint === 'morphology_complete') {
252+
$result = $api->morphology($params);
253+
}
254+
if ($endpoint === 'sentiment') {
255+
$result = $api->sentiment($params);
256+
}
257+
if ($endpoint === 'name-translation') {
258+
$result = $api->nameTranslation($params);
259+
}
260+
if ($endpoint === 'relationships') {
261+
$result = $api->relationships($params);
262+
}
263+
$this->assertEquals($expected, $result[0]);
272264
}
273-
274265
}

0 commit comments

Comments
 (0)