add tests/Catalog - depends on amzn/ion-c#267
authorMichael Wallner <mike@php.net>
Tue, 21 Dec 2021 09:15:30 +0000 (10:15 +0100)
committerMichael Wallner <mike@php.net>
Tue, 21 Dec 2021 09:15:30 +0000 (10:15 +0100)
tests/Catalog.phpt [new file with mode: 0644]

diff --git a/tests/Catalog.phpt b/tests/Catalog.phpt
new file mode 100644 (file)
index 0000000..133f161
--- /dev/null
@@ -0,0 +1,114 @@
+--TEST--
+ion\Catalog
+--EXTENSIONS--
+ion
+--FILE--
+TEST
+<?php
+
+$c = new ion\Catalog;
+var_dump(count($c));
+$c->add(ion\Symbol\Table\PHP());
+var_dump(count($c));
+$c->add(new ion\Symbol\Table\Shared("shared", 1, ["foo", "bar", "baz"]));
+var_dump(count($c));
+$c->add(new ion\Symbol\Table\Shared("shared", 2, ["foo", "bar", "baz", "new"]));
+var_dump(count($c));
+
+
+var_dump($c);
+var_dump($c->find("shared", 1));
+var_dump($c->findBest("shared"));
+
+?>
+DONE
+--EXPECTF--
+TEST
+int(0)
+int(1)
+int(2)
+int(3)
+object(ion\Catalog)#%d (1) {
+  ["symbolTables":"ion\Catalog":private]=>
+  array(6) {
+    [%d]=>
+    object(ion\Symbol\Table\Shared)#%d (3) {
+      ["name"]=>
+      string(3) "PHP"
+      ["version"]=>
+      int(1)
+      ["symbols":"ion\Symbol\Table\Shared":private]=>
+      array(0) {
+      }
+    }
+    ["PHP:1"]=>
+    object(ion\Symbol\Table\Shared)#%d (3) {
+      ["name"]=>
+      string(3) "PHP"
+      ["version"]=>
+      int(1)
+      ["symbols":"ion\Symbol\Table\Shared":private]=>
+      array(0) {
+      }
+    }
+    [%d]=>
+    object(ion\Symbol\Table\Shared)#%d (3) {
+      ["name"]=>
+      string(6) "shared"
+      ["version"]=>
+      int(1)
+      ["symbols":"ion\Symbol\Table\Shared":private]=>
+      array(0) {
+      }
+    }
+    ["shared:1"]=>
+    object(ion\Symbol\Table\Shared)#%d (3) {
+      ["name"]=>
+      string(6) "shared"
+      ["version"]=>
+      int(1)
+      ["symbols":"ion\Symbol\Table\Shared":private]=>
+      array(0) {
+      }
+    }
+    [%d]=>
+    object(ion\Symbol\Table\Shared)#%d (3) {
+      ["name"]=>
+      string(6) "shared"
+      ["version"]=>
+      int(2)
+      ["symbols":"ion\Symbol\Table\Shared":private]=>
+      array(0) {
+      }
+    }
+    ["shared:2"]=>
+    object(ion\Symbol\Table\Shared)#%d (3) {
+      ["name"]=>
+      string(6) "shared"
+      ["version"]=>
+      int(2)
+      ["symbols":"ion\Symbol\Table\Shared":private]=>
+      array(0) {
+      }
+    }
+  }
+}
+object(ion\Symbol\Table\Shared)#%d (3) {
+  ["name"]=>
+  string(6) "shared"
+  ["version"]=>
+  int(1)
+  ["symbols":"ion\Symbol\Table\Shared":private]=>
+  array(0) {
+  }
+}
+object(ion\Symbol\Table\Shared)#%d (3) {
+  ["name"]=>
+  string(6) "shared"
+  ["version"]=>
+  int(2)
+  ["symbols":"ion\Symbol\Table\Shared":private]=>
+  array(0) {
+  }
+}
+DONE