<?php
/**
 * PhpMyObject extensions to Simpletest UnitTestCase class.
 *
 *
 * This file is part of the PhpMyObject project,
 * an Object-Relational Mapping (ORM) system.
 * 
 * For questions, help, comments, discussion, etc., please join our
 * forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770} 
 * or our mailing list at {@link http://groups.google.com/group/pmo-dev}.
 *
 * PhpMyObject is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    	PhpMyObject
 * @subpackage 	PMO_Tests
 * @author     	Louis Lapointe <laplix@gmail.com>
 * @link				http://pmo.developpez.com/
 * @since 			PhpMyObject v0.15
 * @version       $Revision$
 * @copyright  	Copyright (C) 2008 Louis Lapointe
 * @license    	GPLv3 {@link http://www.gnu.org/licenses/gpl}
 * @filesource
 */

/**
 * requires simpletest unit tester
 */
require_once(SIMPLETEST . DS . 'unit_tester.php');

/**
 * require PMO extension to simpletest expectation
 */
require_once(dirname(__FILE__) . DS . 'PMO_expectation.php.');

/**
 * adds a few assertions to the Simpletest UnitTestCase class
 *
 * @package 		PhpMyObject
 * @subpackage 	PMO_Tests
 */
class PMO_UnitTestCase extends UnitTestCase
{

   function PMO_UnitTestCase($label = false)
   {
      if (!$label) {
         $label = get_class($this);
      }
      $this->UnitTestCase($label);
   }

	/**
	 * Returns true if $second is greater than $first, false otherwise.
	 *
	 * @param mixed $first 		value to compare against
	 * @param mixed $second 	value to compare
	 * @param string $message 	message to output in case of failure
	 * @return bool
	 */
   function assertGreaterThan($first, $second, $message = '%s')
   {
      return $this->assert( new GreaterThanExpectation($first), $second, $message);
   }

	/**
	 * Returns true if $second is lower than $first, false otherwise.
	 *
	 * @param mixed $first 		value to compare against
	 * @param mixed $second 	value to compare
	 * @param string $message 	message to output in case of failure
	 * @return bool
	 */
   function assertLowerThan($first, $second, $message = '%s')
   {
      return $this->assert( new LowerThanExpectation($first), $second, $message);
   }

	/**
	 * Returns true if $first is empty, false otherwise.
	 *
	 * Uses the PHP function empty()
	 * @param mixed $first 		value to test
	 * @param string $message 	message to output in case of failure
	 * @return bool
	 */
   function assertIsEmpty($first, $message = '%s')
   {
      return $this->assert( new IsEmptyExpectation($first), $message);
   }

	/**
	 * Returns true if $first is not empty, false otherwise.
	 *
	 * @param mixed $first 		value to test
	 * @param string $message 	message to output in case of failure
	 * @return bool
	 */
   function assertNotEmpty($first, $message = '%s')
   {
      return $this->assert( new NotEmptyExpectation($first), $message);
   }
}

