flush
[m6w6/seekat] / tests / ErrorsTest.php
diff --git a/tests/ErrorsTest.php b/tests/ErrorsTest.php
new file mode 100644 (file)
index 0000000..b99fe92
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+class ErrorsTest extends BaseTest
+{
+       use ConsumePromise;
+       use AssertCancelled;
+       use AssertFailure;
+
+       /**
+        * @dataProvider provideAPI
+        */
+       function testCancellation($api) {
+               $promise = $api->users->m6w6();
+
+               if (!$api->getFuture()->cancelPromise($promise)) {
+                       return;
+               }
+
+               $this->assertCancelled($promise);
+       }
+
+       /**
+        * @dataProvider provideAPI
+        */
+       function test404($api) {
+               $error = $this->assertFailure($api->generate->a404);
+               $this->assertEquals($error->getMessage(), "Not Found");
+       }
+}