Skip to content

Instantly share code, notes, and snippets.

@ferminhg
Last active October 13, 2015 03:57
Show Gist options
  • Save ferminhg/4135322 to your computer and use it in GitHub Desktop.
Save ferminhg/4135322 to your computer and use it in GitHub Desktop.
PHP-Unit: Fichero Base Clase PHP-Unit
<?php
/**
* Clase para PHP-UNIT que carga el document_root por parametros para
* carga de librerias como esta desarollado en marcadores.
*/
if(isset($_SERVER['argv'][2])) {
if(!is_dir($_SERVER['argv'][2])) {
echo("El DocumentRoot especificado no existe o no es correcto.");
exit;
}
$_SERVER['DOCUMENT_ROOT'] = $_SERVER['argv'][2];
}
require_once ($_SERVER['DOCUMENT_ROOT'].'/path/to/classdao.php');
class NameDaoTest extends PHPUnit_Framework_TestCase
{
protected $test;
protected function setUp()
{
// Inicializacion de variables si hiciese falta
}
public function testname()
{
// assertions
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment