X-Git-Url: https://git.rapsys.eu/bbcode/blobdiff_plain/6c4c81d7f5790de40252709342d896ce3f50cf0a..31f0ef676efcb0704a3af502c7141125f91ff4c4:/tests/002.phpt diff --git a/tests/002.phpt b/tests/002.phpt index b9d101a..f6414a3 100644 --- a/tests/002.phpt +++ b/tests/002.phpt @@ -1,63 +1,20 @@ --TEST-- -Check for bbcode functions +Check for missing tag in child --SKIPIF-- --FILE-- [ - ], - '' => [ - 'type' => BBCODE::TYPE_ROOT, - 'child' => ['ul','url','img','b','i'] - ], - 'i' => [ - 'type' => BBCODE::TYPE_MULTI - //TODO: by default open tag = and close tag = - ], - 'b' => [ - 'type' => BBCODE::TYPE_MULTI - ], - 'ul' => [ - 'type' => BBCODE::TYPE_MULTI, - 'child' => ['li'] - ], - 'li' => [ - 'type' => BBCODE::TYPE_MULTI, - 'parent' => ['ul'], - 'child' => ['url','img','b','i'] - ], - 'url' => [ - 'type' => BBCODE::TYPE_MULTI, - 'parent' => ['','li','b','i'], - 'open' => '', - 'close' => '', - 'arg' => 'href' - ], - ], - [ - ':)' => ':)', - ':(' => ':(', - ':D' => ':D', - ':p' => ':p', - ':|' => ':|', - ':6:' => ':6:' - ], - BBCODE::REMOVE_EMPTY -); -echo $obj->parse('[ul][li][url=https://rapsys.eu]Rapsys[/url][/li][li][url=https://google.fr]Google[/url][/li][/ul]'); -/* - you can add regression tests for your extension here - - the output of your test code has to be equal to the - text in the --EXPECT-- section below for the tests - to pass, differences between the output and the - expected text are interpreted as failure - - see php7/README.TESTING for further information on - writing regression tests -*/ -?> +try { + $obj = new bbcode( + [ + '' => [ + 'type' => BBCODE::TYPE_ROOT, + 'child' => ['missing'] + ] + ] + ); +} catch (Exception $e) { + echo $e->getMessage(); +} --EXPECT-- -[ul][li][url=https://rapsys.eu]Rapsys[/url][/li][li][url=https://google.fr]Google[/url][/li][/ul] +BBCode::__construct(): Child value missing for key [0]/child[1] is not present in tag keys