AbResultsTest.php 1.0 KB

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