1
0
Fork 0

- Added PHPUnit TestCase for custom assertions.

Dieser Commit ist enthalten in:
D4rk4ng3l 2012-09-12 20:18:55 +00:00
Ursprung a2ac0b33e4
Commit 7df515daf7
2 geänderte Dateien mit 133 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,44 @@
<?php
/**
* This file is part of MySQLDumper released under the GNU/GPL 2 license
* http://www.mysqldumper.net
*
* @package MySQLDumper
* @subpackage PHPUnit
* @version SVN: $Rev$
* @author $Author$
*/
/**
* Abstract class to extend PHPUnit tests with custom assertions.
*
* @package MySQLDumper
* @subpackage PHPUnit
*/
abstract class Msd_PHPUnit_TestCase extends PHPUnit_Framework_TestCase
{
/**
* Assertion to test that an array has at least a structure.
*
* @param array $structure Excepted structure of the array.
* @param array $array Array to test.
* @param string $message Additional information about the test.
*
* @return void
*/
public static function assertArrayHasStructure($structure, $array, $message = '')
{
self::assertThat($array, self::arrayHasStructure($structure, $message));
}
/**
* Returns the constraint for the assertion.
*
* @param array $structure Excepted structure of the array.
*
* @return Msd_PHPUnit_Constraint_ArrayHasStructure
*/
public static function arrayHasStructure($structure)
{
return new Msd_PHPUnit_Constraint_ArrayHasStructure($structure);
}
}