示例#1
0
 /**
  * @testdox asConfig() packs boolean rules in a value named "flags"
  */
 public function testAsConfigBitfield()
 {
     $booleanRules = ['autoClose' => Parser::RULE_AUTO_CLOSE, 'autoReopen' => Parser::RULE_AUTO_REOPEN, 'breakParagraph' => Parser::RULE_BREAK_PARAGRAPH, 'createParagraphs' => Parser::RULE_CREATE_PARAGRAPHS, 'disableAutoLineBreaks' => Parser::RULE_DISABLE_AUTO_BR, 'enableAutoLineBreaks' => Parser::RULE_ENABLE_AUTO_BR, 'ignoreSurroundingWhitespace' => Parser::RULE_IGNORE_WHITESPACE, 'ignoreTags' => Parser::RULE_IGNORE_TAGS, 'ignoreText' => Parser::RULE_IGNORE_TEXT, 'isTransparent' => Parser::RULE_IS_TRANSPARENT, 'preventLineBreaks' => Parser::RULE_PREVENT_BR, 'suspendAutoLineBreaks' => Parser::RULE_SUSPEND_AUTO_BR, 'trimFirstLine' => Parser::RULE_TRIM_FIRST_LINE];
     $ruleset = new Ruleset();
     foreach ($booleanRules as $methodName => $bitValue) {
         $ruleset->clear();
         $ruleset->{$methodName}();
         $config = $ruleset->asConfig();
         $this->assertArrayHasKey('flags', $config);
         $this->assertSame($bitValue, $config['flags']);
     }
 }