/** * @testdox asConfig() can pack multiple boolean rules in a value named "flags" */ public function testAsConfigBitfieldMultiple() { $ruleset = new Ruleset(); $ruleset->autoClose(); $ruleset->ignoreSurroundingWhitespace(); $config = $ruleset->asConfig(); $this->assertSame(Parser::RULE_AUTO_CLOSE | Parser::RULE_IGNORE_WHITESPACE, $config['flags']); }
/** * @testdox Tags that are allowed in a closed dependency loop are omitted from the return array */ public function testUnusedTagsInLoop() { $tags = new TagCollection(); $tags->add('A'); $tags->add('B'); $rootRules = new Ruleset(); $rootRules->denyChild('A'); $rootRules->denyChild('B'); $this->assertEquals(['root' => ['allowed' => [0]], 'tags' => []], RulesHelper::getBitfields($tags, $rootRules)); }
/** * @testdox $tag->rules can be assigned an instance of Ruleset to copy its content */ public function testRulesInstanceOfRuleset() { $ruleset = new Ruleset(); $ruleset->allowChild('B'); $tag = new Tag(); $tag->rules = $ruleset; $this->assertEquals($ruleset, $tag->rules); $this->assertNotSame($ruleset, $tag->rules, '$tag->rules should not have been replaced with $ruleset'); }