| 3 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Ratchet\RFC6455\Test;
|
|
|
4 |
use PHPUnit\Framework\TestCase;
|
|
|
5 |
|
|
|
6 |
class AbResultsTest extends TestCase {
|
|
|
7 |
private function verifyAutobahnResults($fileName) {
|
|
|
8 |
if (!file_exists($fileName)) {
|
|
|
9 |
return $this->markTestSkipped('Autobahn TestSuite results not found');
|
|
|
10 |
}
|
|
|
11 |
|
|
|
12 |
$resultsJson = file_get_contents($fileName);
|
|
|
13 |
$results = json_decode($resultsJson);
|
|
|
14 |
$agentName = array_keys(get_object_vars($results))[0];
|
|
|
15 |
|
|
|
16 |
foreach ($results->$agentName as $name => $result) {
|
|
|
17 |
if ($result->behavior === "INFORMATIONAL") {
|
|
|
18 |
continue;
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
$this->assertTrue(in_array($result->behavior, ["OK", "NON-STRICT"]), "Autobahn test case " . $name . " in " . $fileName);
|
|
|
22 |
}
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
public function testAutobahnClientResults() {
|
|
|
26 |
$this->verifyAutobahnResults(__DIR__ . '/ab/reports/clients/index.json');
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
public function testAutobahnServerResults() {
|
|
|
30 |
$this->verifyAutobahnResults(__DIR__ . '/ab/reports/servers/index.json');
|
|
|
31 |
}
|
|
|
32 |
}
|