Exemplo n.º 1
0
 public function testRatioAndGuarantee()
 {
     $claims = $this->prophesize('asylgrp\\workbench\\Domain\\ClaimArray');
     $claims->getHash()->willReturn('hash');
     $claims = $claims->reveal();
     $fundsPre = new SEK('100');
     $fundPost = new SEK('50');
     $ratio = new SEK('.1');
     $guarantee = new SEK('1000');
     $allocator = $this->prophesize('asylgrp\\workbench\\Domain\\Allocator\\Allocator');
     $allocator->allocate($claims, $fundsPre)->willReturn($fundPost);
     $ratioAllocator = $this->prophesize('asylgrp\\workbench\\Domain\\Allocator\\RatioAllocator');
     $ratioAllocator->getRatio()->willReturn($ratio);
     $guaranteeAllocator = $this->prophesize('asylgrp\\workbench\\Domain\\Allocator\\GuaranteeAllocator');
     $guaranteeAllocator->getGuarantee()->willReturn($guarantee);
     $factory = new DecisionFactory($allocator->reveal(), $ratioAllocator->reveal(), $guaranteeAllocator->reveal());
     $factory->setClaims($claims);
     $factory->setFunds($fundsPre);
     $decision = $factory->getDecision();
     $this->assertSame($ratio, $decision->getRatio());
     $this->assertSame($guarantee, $decision->getGuarantee());
 }
Exemplo n.º 2
0
 /**
  * @return Domain\DecisionFactory
  */
 public function decisionFactory()
 {
     $factory = new Domain\DecisionFactory(new Domain\Allocator\AllocatorSet([new Domain\Allocator\ResetAllocator(), $this->get('guaranteeAllocator'), $this->get('\\asylgrp\\workbench\\Domain\\Allocator\\RatioAllocator'), new Domain\Allocator\RoundDownAllocator()]), $this->get('\\asylgrp\\workbench\\Domain\\Allocator\\RatioAllocator'), $this->get('guaranteeAllocator'));
     $factory->setClaims(new Domain\ClaimArray(iterator_to_array($this->get('claimStorage')->readAll())));
     return $factory;
 }