Exemplo n.º 1
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     //set up test objects
     //set up test object
     $mockCard = $this->getMock('Cilex\\Cards\\Card', array('getValue'), array(1, 5));
     $mockCard->expects($this->any())->method('getValue')->will($this->returnValue(5));
     $mockHand = $this->getMock('Cilex\\Cards\\Hand', array('addCard', 'show', 'getCardCount'));
     $mockHand->expects($this->any())->method('addCard')->will($this->returnValue($mockCard));
     $mockHand->expects($this->any())->method('show')->will($this->returnValue(array(0 => $mockCard)));
     switch ($this->getName()) {
         case 'testGameLogicWithNoWinner':
             $mockHand->expects($this->any())->method('getCardCount')->will($this->returnValue(0));
             break;
         default:
             $mockHand->expects($this->any())->method('getCardCount')->will($this->returnValue(1));
             break;
     }
     $this->mockPlayer = $this->getMock('Cilex\\Players\\CasualPlayer', array('getHand'));
     $this->mockPlayer->expects($this->any())->method('getHand')->will($this->returnValue($mockHand));
     $mockDeck = $this->getMock('Cilex\\Cards\\Deck');
     $this->object = new \Cilex\Games\Sevens($mockDeck);
 }
Exemplo n.º 2
0
 /**
  * @covers Cilex\Players\Player::setWins
  * @covers Cilex\Players\Player::getWins
  */
 public function testSetWins()
 {
     $this->object->setWins();
     $this->assertEquals(1, $this->object->getWins());
 }