PHP Classes
elePHPant
Icontem

File: test/BoardTest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Amin Saeidi  >  Tic-Tac-Toe  >  test/BoardTest.php  >  Download  
File: test/BoardTest.php
Role: Unit test script
Content type: text/plain
Description: test
Class: Tic-Tac-Toe
Tic-Tac-Toe game using alpha beta search algorithm
Author: By
Last change:
Date: 4 years ago
Size: 789 bytes
 

Contents

Class file image Download
<?php
require_once 'PHPUnit/Framework.php';
require_once
'Board.php';

class
BoardTest extends PHPUnit_Framework_TestCase
{
   
/**
     * @var Board
     */
   
protected $object;

    protected function
setUp()
    {
       
$this->object = new Board(array(0, -1, 0, 1, 1, 0, 0, -1, 0));
    }

    public function
testCount()
    {
       
$this->assertEquals(9, count($this->object));
    }

    public function
testReset()
    {
       
$empty = array(0, 0, 0, 0, 0, 0, 0, 0, 0);
       
$this->assertEquals($this->object->reset()->get(), $empty);
    }

    public function
testGet()
    {
       
$this->assertEquals($this->object->get(1), -1);
    }

    public function
testSet()
    {
      
$this->object->set(2, 1);
      
$this->assertEquals($this->object->get(2), 1);
    }
}