From b0ce8a15a0cbde4aed12fcdd10c75e66e0c0c231 Mon Sep 17 00:00:00 2001 From: Fernando Date: Fri, 13 Jul 2012 07:56:19 -0400 Subject: [PATCH] fixing all gulliver phpunits --- .../system/classTemplatePowerParserTest.php | 24 +++--- .../gulliver/system/classWebResourceTest.php | 79 ------------------- .../gulliver/system/classxmlMenuTest.php | 1 - tests/tools/generateTestUnit.php | 2 +- 4 files changed, 14 insertions(+), 92 deletions(-) delete mode 100644 tests/automated/gulliver/system/classWebResourceTest.php diff --git a/tests/automated/gulliver/system/classTemplatePowerParserTest.php b/tests/automated/gulliver/system/classTemplatePowerParserTest.php index bf36eb338..933706c6d 100644 --- a/tests/automated/gulliver/system/classTemplatePowerParserTest.php +++ b/tests/automated/gulliver/system/classTemplatePowerParserTest.php @@ -26,7 +26,9 @@ class classTemplatePowerParserTest extends PHPUnit_Framework_TestCase */ protected function setUp() { - $this->object = new TemplatePowerParser(); + $tpl_file=''; + $type=''; + $this->object = new TemplatePowerParser($tpl_file, $type); } /** @@ -38,7 +40,7 @@ class classTemplatePowerParserTest 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. */ public function testNumberOfMethodsInThisClass() @@ -62,7 +64,7 @@ class classTemplatePowerParserTest extends PHPUnit_Framework_TestCase $this->assertTrue( $params[1]->getName() == 'type'); $this->assertTrue( $params[1]->isArray() == false); $this->assertTrue( $params[1]->isOptional () == false); - } + } /** * @covers TemplatePowerParser::__errorAlert @@ -77,7 +79,7 @@ class classTemplatePowerParserTest extends PHPUnit_Framework_TestCase $this->assertTrue( $params[0]->getName() == 'message'); $this->assertTrue( $params[0]->isArray() == false); $this->assertTrue( $params[0]->isOptional () == false); - } + } /** * @covers TemplatePowerParser::__prepare @@ -89,7 +91,7 @@ class classTemplatePowerParserTest extends PHPUnit_Framework_TestCase $this->assertTrue( in_array('__prepare', $methods ), 'exists method __prepare' ); $r = new ReflectionMethod('TemplatePowerParser', '__prepare'); $params = $r->getParameters(); - } + } /** * @covers TemplatePowerParser::__cleanUp @@ -101,7 +103,7 @@ class classTemplatePowerParserTest extends PHPUnit_Framework_TestCase $this->assertTrue( in_array('__cleanUp', $methods ), 'exists method __cleanUp' ); $r = new ReflectionMethod('TemplatePowerParser', '__cleanUp'); $params = $r->getParameters(); - } + } /** * @covers TemplatePowerParser::__prepareTemplate @@ -119,7 +121,7 @@ class classTemplatePowerParserTest extends PHPUnit_Framework_TestCase $this->assertTrue( $params[1]->getName() == 'type'); $this->assertTrue( $params[1]->isArray() == false); $this->assertTrue( $params[1]->isOptional () == false); - } + } /** * @covers TemplatePowerParser::__parseTemplate @@ -140,7 +142,7 @@ class classTemplatePowerParserTest extends PHPUnit_Framework_TestCase $this->assertTrue( $params[2]->getName() == 'initdev'); $this->assertTrue( $params[2]->isArray() == false); $this->assertTrue( $params[2]->isOptional () == false); - } + } /** * @covers TemplatePowerParser::version @@ -152,7 +154,7 @@ class classTemplatePowerParserTest extends PHPUnit_Framework_TestCase $this->assertTrue( in_array('version', $methods ), 'exists method version' ); $r = new ReflectionMethod('TemplatePowerParser', 'version'); $params = $r->getParameters(); - } + } /** * @covers TemplatePowerParser::assignInclude @@ -174,6 +176,6 @@ class classTemplatePowerParserTest extends PHPUnit_Framework_TestCase $this->assertTrue( $params[2]->isArray() == false); $this->assertTrue( $params[2]->isOptional () == true); $this->assertTrue( $params[2]->getDefaultValue() == '0'); - } + } - } + } diff --git a/tests/automated/gulliver/system/classWebResourceTest.php b/tests/automated/gulliver/system/classWebResourceTest.php deleted file mode 100644 index c657a1a0f..000000000 --- a/tests/automated/gulliver/system/classWebResourceTest.php +++ /dev/null @@ -1,79 +0,0 @@ -object = new WebResource(); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * This is the default method to test, if the class still having - * the same number of methods. - */ - public function testNumberOfMethodsInThisClass() - { - $methods = get_class_methods('WebResource'); $this->assertTrue( count($methods) == 2); - } - - /** - * @covers WebResource::WebResource - * @todo Implement testWebResource(). - */ - public function testWebResource() - { - $methods = get_class_methods($this->object); - $this->assertTrue( in_array('WebResource', $methods ), 'exists method WebResource' ); - $r = new ReflectionMethod('WebResource', 'WebResource'); - $params = $r->getParameters(); - $this->assertTrue( $params[0]->getName() == 'uri'); - $this->assertTrue( $params[0]->isArray() == false); - $this->assertTrue( $params[0]->isOptional () == false); - $this->assertTrue( $params[1]->getName() == 'post'); - $this->assertTrue( $params[1]->isArray() == false); - $this->assertTrue( $params[1]->isOptional () == false); - } - - /** - * @covers WebResource::_encode - * @todo Implement test_encode(). - */ - public function test_encode() - { - $methods = get_class_methods($this->object); - $this->assertTrue( in_array('_encode', $methods ), 'exists method _encode' ); - $r = new ReflectionMethod('WebResource', '_encode'); - $params = $r->getParameters(); - } - - } diff --git a/tests/automated/gulliver/system/classxmlMenuTest.php b/tests/automated/gulliver/system/classxmlMenuTest.php index 09249d4ee..569a51b15 100644 --- a/tests/automated/gulliver/system/classxmlMenuTest.php +++ b/tests/automated/gulliver/system/classxmlMenuTest.php @@ -26,7 +26,6 @@ class classxmlMenuTest extends PHPUnit_Framework_TestCase */ protected function setUp() { - require_once(PATH_TRUNK . 'gulliver/thirdparty/pear/json/class.json.php'); $file = 'login/login.xml'; $home = PATH_TRUNK . 'workflow/engine/xmlform/'; $this->object = new xmlMenu($file, $home); diff --git a/tests/tools/generateTestUnit.php b/tests/tools/generateTestUnit.php index 8b0edf13f..6e064fe63 100644 --- a/tests/tools/generateTestUnit.php +++ b/tests/tools/generateTestUnit.php @@ -42,7 +42,7 @@ require_once ROOT_PATH . 'gulliver/system/class.dbconnection.php'; //parsingFolder('gulliver/system', 'class.form.php class.objectTemplate.php class.tree.php class.xmlform.php class.filterForm.php'); parsingFolder('gulliver/system', 'class.database_mssql.php class.database_mysql.php class.htmlArea.php ' . - 'class.dbconnection.php class.dbrecordset.php class.dbsession.php class.soapNtlm.php' ); + 'class.dbconnection.php class.dbrecordset.php class.dbsession.php class.soapNtlm.php class.webResource.php' ); parsingFolder('workflow/engine/classes', 'class.xmlfield_Image.php class.groupUser.php class.group.php class.system.php ' . 'class.ArrayPeer.php class.ArrayPeer.php class.BasePeer.php class.dbConnections.php class.webdav.php');