Exemple #1
0
 public function testFirstGroup()
 {
     $context = new Context();
     $this->assertNull($context->getFirstGroup());
     $context->setFirstGroup('test');
     $this->assertEquals('test', $context->getFirstGroup());
     $this->assertEquals('test', $context->get(Context::FIRST_GROUP));
 }
 public function testGroupRangeApplicableCheckerWithFirstGroupOnly()
 {
     $context = new Context();
     $context->setAction('action1');
     $context->setFirstGroup('group2');
     $processorBag = new ProcessorBag($this->getProcessorFactory());
     $processorBag->addGroup('group1', 'action1', -10);
     $processorBag->addGroup('group2', 'action1', -20);
     $processorBag->addGroup('group4', 'action1', -30);
     $processorBag->addGroup('group3', 'action1', -40);
     $processorBag->addGroup('group5', 'action1', -50);
     $processorBag->addGroup('group6', 'action1', -60);
     $processorBag->addProcessor('processor1_no_action', []);
     $processorBag->addProcessor('processor2_no_action', [], null, null, -65536);
     $processorBag->addProcessor('processor1_no_group', [], 'action1');
     $processorBag->addProcessor('processor2_no_group', [], 'action1', null, -65280);
     $processorBag->addProcessor('processor1', [], 'action1', 'group1');
     $processorBag->addProcessor('processor2', [], 'action1', 'group2');
     $processorBag->addProcessor('processor3', [], 'action1', 'group3');
     $processorBag->addProcessor('processor4', [], 'action1', 'group4');
     $processorBag->addProcessor('processor5', [], 'action1', 'group5');
     $processorBag->addProcessor('processor6', [], 'action1', 'group6');
     $this->assertProcessors(['processor1_no_action', 'processor1_no_group', 'processor2', 'processor4', 'processor3', 'processor5', 'processor6', 'processor2_no_group', 'processor2_no_action'], $processorBag->getProcessors($context));
 }