예제 #1
0
 public function testBasketCapacity()
 {
     $basket = new Basket\Entity\Basket('Test', 2);
     $basket->addBall(new Balls\Entity\Ball(1));
     $basket->addBall(new Balls\Entity\Ball(2));
     $this->assertFalse($basket->addBall(new Balls\Entity\Ball(3)));
 }
 /**
  * @depends testCreate
  */
 public function testCheckTrue(OnlyOwnedBallsCriteria $criteria)
 {
     $basket = new Basket\Entity\Basket('test', 2);
     $basket->getBalls()->addBall(new Balls\Entity\Ball(1));
     $basket->getBalls()->addBall(new Balls\Entity\Ball(2));
     $this->assertTrue($criteria->check($basket));
 }
예제 #3
0
 public function loadBalls(Universe\Provider\BallsProviderInterface $provider, Universe\Factory\BallFactoryInterface $ballFactory)
 {
     while ($number = $provider->getBall()) {
         $ball = $ballFactory->createBall($number);
         $this->basket->addBall($ball);
     }
     return true;
 }
 /**
  * @depends testCreate
  */
 public function testCheckTrue(ExactlyOneBallCriteria $criteria)
 {
     $basket = new Basket\Entity\Basket('test', 1);
     $basket->getBalls()->addBall(new Balls\Entity\Ball(1));
     $this->assertTrue($criteria->check($basket));
 }
예제 #5
0
 /**
  * @depends testCreate
  */
 public function testToString(Basket\Entity\Basket $basket)
 {
     $balls = $basket->getBalls();
     $string = vsprintf(Basket\Entity\Basket::BASKET_STRING_PATTERN, array($basket->getName(), (string) $basket->getBalls()));
     $this->assertEquals($string, (string) $basket);
 }