From 111f3453287fb6f71dc439038c1d7b435cb05656 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 21 Dec 2021 10:15:30 +0100 Subject: [PATCH] add tests/Catalog - depends on amzn/ion-c#267 --- tests/Catalog.phpt | 114 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 tests/Catalog.phpt diff --git a/tests/Catalog.phpt b/tests/Catalog.phpt new file mode 100644 index 0000000..133f161 --- /dev/null +++ b/tests/Catalog.phpt @@ -0,0 +1,114 @@ +--TEST-- +ion\Catalog +--EXTENSIONS-- +ion +--FILE-- +TEST +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 -- 2.30.2