Merge pull request #291 from victorsl/master

BUG 0000 "PHPUNIT instantiation classPMScriptTest.php" SOLVED
This commit is contained in:
julceslauhub
2012-07-13 16:15:07 -07:00
2 changed files with 24 additions and 22 deletions

View File

@@ -26,7 +26,7 @@ class classFileCacheTest extends PHPUnit_Framework_TestCase
*/ */
protected function setUp() protected function setUp()
{ {
$this->object = new FileCache(); $this->object = new FileCache(null);
} }
/** /**
@@ -38,12 +38,13 @@ class classFileCacheTest extends PHPUnit_Framework_TestCase
} }
/** /**
* This is the default method to test, if the class still having * This is the default method to test, if the class still having
* the same number of methods. * the same number of methods.
*/ */
public function testNumberOfMethodsInThisClass() public function testNumberOfMethodsInThisClass()
{ {
$methods = get_class_methods('FileCache'); $this->assertTrue( count($methods) == 4); $methods = get_class_methods('FileCache');
$this->assertTrue(count($methods) == 4);
} }
/** /**
@@ -59,7 +60,7 @@ class classFileCacheTest extends PHPUnit_Framework_TestCase
$this->assertTrue( $params[0]->getName() == 'dir'); $this->assertTrue( $params[0]->getName() == 'dir');
$this->assertTrue( $params[0]->isArray() == false); $this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false); $this->assertTrue( $params[0]->isOptional () == false);
} }
/** /**
* @covers FileCache::get * @covers FileCache::get
@@ -78,7 +79,7 @@ class classFileCacheTest extends PHPUnit_Framework_TestCase
$this->assertTrue( $params[1]->isArray() == false); $this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == true); $this->assertTrue( $params[1]->isOptional () == true);
$this->assertTrue( $params[1]->getDefaultValue() == '3600'); $this->assertTrue( $params[1]->getDefaultValue() == '3600');
} }
/** /**
* @covers FileCache::set * @covers FileCache::set
@@ -96,7 +97,7 @@ class classFileCacheTest extends PHPUnit_Framework_TestCase
$this->assertTrue( $params[1]->getName() == 'data'); $this->assertTrue( $params[1]->getName() == 'data');
$this->assertTrue( $params[1]->isArray() == false); $this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == false); $this->assertTrue( $params[1]->isOptional () == false);
} }
/** /**
* @covers FileCache::clear * @covers FileCache::clear
@@ -111,6 +112,6 @@ class classFileCacheTest extends PHPUnit_Framework_TestCase
$this->assertTrue( $params[0]->getName() == 'key'); $this->assertTrue( $params[0]->getName() == 'key');
$this->assertTrue( $params[0]->isArray() == false); $this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false); $this->assertTrue( $params[0]->isOptional () == false);
} }
}
}

View File

@@ -38,12 +38,13 @@ class classPMScriptTest extends PHPUnit_Framework_TestCase
} }
/** /**
* This is the default method to test, if the class still having * This is the default method to test, if the class still having
* the same number of methods. * the same number of methods.
*/ */
public function testNumberOfMethodsInThisClass() public function testNumberOfMethodsInThisClass()
{ {
$methods = get_class_methods('PMScript'); $this->assertTrue( count($methods) == 7); $methods = get_class_methods('PMScript');
$this->assertTrue(count($methods) == 7);
} }
/** /**
@@ -56,7 +57,7 @@ class classPMScriptTest extends PHPUnit_Framework_TestCase
$this->assertTrue( in_array('PMScript', $methods ), 'exists method PMScript' ); $this->assertTrue( in_array('PMScript', $methods ), 'exists method PMScript' );
$r = new ReflectionMethod('PMScript', 'PMScript'); $r = new ReflectionMethod('PMScript', 'PMScript');
$params = $r->getParameters(); $params = $r->getParameters();
} }
/** /**
* @covers PMScript::setFields * @covers PMScript::setFields
@@ -68,11 +69,11 @@ class classPMScriptTest extends PHPUnit_Framework_TestCase
$this->assertTrue( in_array('setFields', $methods ), 'exists method setFields' ); $this->assertTrue( in_array('setFields', $methods ), 'exists method setFields' );
$r = new ReflectionMethod('PMScript', 'setFields'); $r = new ReflectionMethod('PMScript', 'setFields');
$params = $r->getParameters(); $params = $r->getParameters();
$this->assertTrue( $params[0]->getName() == 'aFields'); $this->assertTrue($params[0]->getName() == 'aFields');
$this->assertTrue( $params[0]->isArray() == false); $this->assertTrue($params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == true); $this->assertTrue($params[0]->isOptional () == true);
$this->assertTrue( $params[0]->getDefaultValue() == 'Array'); $this->assertTrue($params[0]->getDefaultValue() == array());
} }
/** /**
* @covers PMScript::setScript * @covers PMScript::setScript
@@ -88,7 +89,7 @@ class classPMScriptTest extends PHPUnit_Framework_TestCase
$this->assertTrue( $params[0]->isArray() == false); $this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == true); $this->assertTrue( $params[0]->isOptional () == true);
$this->assertTrue( $params[0]->getDefaultValue() == ''); $this->assertTrue( $params[0]->getDefaultValue() == '');
} }
/** /**
* @covers PMScript::validSyntax * @covers PMScript::validSyntax
@@ -103,7 +104,7 @@ class classPMScriptTest extends PHPUnit_Framework_TestCase
$this->assertTrue( $params[0]->getName() == 'sScript'); $this->assertTrue( $params[0]->getName() == 'sScript');
$this->assertTrue( $params[0]->isArray() == false); $this->assertTrue( $params[0]->isArray() == false);
$this->assertTrue( $params[0]->isOptional () == false); $this->assertTrue( $params[0]->isOptional () == false);
} }
/** /**
* @covers PMScript::executeAndCatchErrors * @covers PMScript::executeAndCatchErrors
@@ -121,7 +122,7 @@ class classPMScriptTest extends PHPUnit_Framework_TestCase
$this->assertTrue( $params[1]->getName() == 'sCode'); $this->assertTrue( $params[1]->getName() == 'sCode');
$this->assertTrue( $params[1]->isArray() == false); $this->assertTrue( $params[1]->isArray() == false);
$this->assertTrue( $params[1]->isOptional () == false); $this->assertTrue( $params[1]->isOptional () == false);
} }
/** /**
* @covers PMScript::execute * @covers PMScript::execute
@@ -133,7 +134,7 @@ class classPMScriptTest extends PHPUnit_Framework_TestCase
$this->assertTrue( in_array('execute', $methods ), 'exists method execute' ); $this->assertTrue( in_array('execute', $methods ), 'exists method execute' );
$r = new ReflectionMethod('PMScript', 'execute'); $r = new ReflectionMethod('PMScript', 'execute');
$params = $r->getParameters(); $params = $r->getParameters();
} }
/** /**
* @covers PMScript::evaluate * @covers PMScript::evaluate
@@ -145,6 +146,6 @@ class classPMScriptTest extends PHPUnit_Framework_TestCase
$this->assertTrue( in_array('evaluate', $methods ), 'exists method evaluate' ); $this->assertTrue( in_array('evaluate', $methods ), 'exists method evaluate' );
$r = new ReflectionMethod('PMScript', 'evaluate'); $r = new ReflectionMethod('PMScript', 'evaluate');
$params = $r->getParameters(); $params = $r->getParameters();
} }
}
}