From: Michael Wallner Date: Tue, 21 Dec 2021 09:15:30 +0000 (+0100) Subject: add tests/Catalog - depends on amzn/ion-c#267 X-Git-Tag: v0.1.0~59 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=111f3453287fb6f71dc439038c1d7b435cb05656;p=awesomized%2Fext-ion add tests/Catalog - depends on amzn/ion-c#267 --- 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