Пример #1
0
 /**
  * @testdox Default rules
  * @dataProvider getDefault
  */
 public function testDefault($tags, $expected)
 {
     $rulesGenerator = new RulesGenerator();
     $tagCollection = new TagCollection();
     foreach ($tags as $tagName => $template) {
         $tag = $tagCollection->add($tagName);
         if (isset($template)) {
             $tag->template = $template;
         }
     }
     $this->assertEquals($expected, $rulesGenerator->getRules($tagCollection));
 }
Пример #2
0
 /**
  * @testdox Bitfields are compressed by making tags that are targeted by the same permissions share the same bit number
  */
 public function testTwoIdenticalTags()
 {
     $tags = new TagCollection();
     $tags->add('A');
     $tags->add('B');
     $this->assertEquals(['root' => ['allowed' => [0b100000001]], 'tags' => ['A' => ['bitNumber' => 0, 'allowed' => [0b100000001]], 'B' => ['bitNumber' => 0, 'allowed' => [0b100000001]]]], RulesHelper::getBitfields($tags, new Ruleset()));
 }
Пример #3
0
 /**
  * @testdox Throws an exception when accessing a Tag that does not exist
  * @expectedException RuntimeException
  * @expectedExceptionMessage Tag 'X' does not exist
  */
 public function testNotExist()
 {
     $collection = new TagCollection();
     $collection->get('X');
 }