Exemplo n.º 1
0
 public function testInsertAerialIntoHoppingTree()
 {
     $this->sample->createHoppingTree();
     $treyflip = $this->sample->getTreyflip();
     $unispin180 = $this->sample->getUnispin180();
     // initial calculation
     $calculator = new Calculator();
     $calculator->calculate($treyflip);
     // lineage for 180 unispin
     $this->assertEquals([1, 9, 10], $this->getLineageIds($unispin180));
     // add aerial
     $aerial = $this->sample->createSkill(1000, 'Aerial');
     $aerial->addSkillRelatedByParentId($this->sample->getHoppingSIF());
     $calculator->reset();
     $calculator->calculate($aerial);
     // assert aerial
     $this->assertEquals([1, 9, 10], $this->getLineageIds($aerial));
     $this->assertEquals(4, $aerial->getGeneration());
     $this->assertEquals(0, $aerial->getImportance());
     // add aerial as parent for 180 unispin
     $unispin180->clearSkillsRelatedByParentId();
     $unispin180->addSkillRelatedByParentId($aerial);
     $calculator->reset();
     $calculator->calculate($unispin180);
     // assert 180 unispin
     $this->assertEquals(5, $unispin180->getGeneration());
     $this->assertEquals([1, 9, 10, 1000], $this->getLineageIds($unispin180));
     // assert treyflip
     $this->assertEquals(7, $treyflip->getGeneration());
     $this->assertEquals([1, 9, 10, 1000, 12, 13], $this->getLineageIds($treyflip));
 }
Exemplo n.º 2
0
 public function testSpinTree()
 {
     $this->sample->createSpinTree();
     $spin1ftExt = $this->sample->getSpin1ftExt();
     $this->assertEquals($this->sample->getSpin1ft(), $spin1ftExt->getVariationOf());
     $this->assertEquals(4, count($spin1ftExt->getAncestors()));
     $root = $this->sample->getRootSkill();
     $this->assertEquals(7, count($root->getDescendents()));
     $spin1ft = $this->sample->getSpin1ft();
     $this->assertEquals(2, count($spin1ft->getVariations()));
 }