public function testUsingTagsToDefineDependencies() { $op1 = new GenericOperation(1); $op2 = new GenericOperation(2); $op2->addTag('MyTag'); $op3 = new GenericOperation(3); $op3->addTag('MyTag'); $op4 = new GenericOperation(4); $op4->addTag('MyTag'); $op5 = new GenericOperation(5); $dm = new DependencyManager(); $dm->addOperation($op1); $dm->addOperation($op2); $dm->addOperation($op3); $dm->addOperation($op4); $dm->addOperation($op5); // 1 // / | \ // 2 3 4 // \ | / // 5 $dm->addDependencyByTag($op1, 'MyTag'); $dm->addDependencyByTag('MyTag', $op5); $ops = $dm->getExecutableOperations(); $this->assertCount(1, $ops); $this->assertContains($op1, $ops); $dm->markAsExecuted($op1); $ops = $dm->getExecutableOperations(); $this->assertCount(3, $ops); $this->assertContains($op2, $ops); $this->assertContains($op3, $ops); $this->assertContains($op4, $ops); $dm->markAsExecuted($op2); $dm->markAsExecuted($op3); $dm->markAsExecuted($op4); $ops = $dm->getExecutableOperations(); $this->assertCount(1, $ops); $this->assertContains($op5, $ops); }