Changeset 1314
- Timestamp:
- 01/31/08 08:58:20 (5 months ago)
- Files:
-
- trunk/build/star/build.xml (modified) (2 diffs)
- trunk/src/test/php/org/stubbles/star/StarFileTestCase.php (modified) (3 diffs)
- trunk/src/test/php/org/stubbles/star/run.php (deleted)
- trunk/src/test/php/org/stubbles/star/starTestSuite.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/star/build.xml
r1210 r1314 5 5 <property name="pkg.name" value="star-${version}"/> 6 6 <property name="build.src.dir" value="${build.base.dir}/${pkg.name}"/> 7 <taskDef name="mySimpletest" classname="MySimpleTestTask" classpath="${stubbles.base.dir}/src/test" />8 7 9 8 <target name="main" if="version" depends="test,build"/> … … 59 58 60 59 <target name="test" description="run test suite"> 61 < mySimpletest testfile=""${stubbles.base.dir}/src/test/php/org/stubbles/star/run.php"" exit="true"/>60 <exec passthru="true" command="phpunit src_test_php_org_stubbles_star_starTestSuite"/> 62 61 </target> 63 62 </project> trunk/src/test/php/org/stubbles/star/StarFileTestCase.php
r1210 r1314 14 14 * @subpackage star_test 15 15 */ 16 class StarFileTestCase extends UnitTestCase16 class StarFileTestCase extends PHPUnit_Framework_TestCase 17 17 { 18 18 /** … … 34 34 */ 35 35 protected $dirname; 36 36 37 37 /** 38 38 * set up test environment … … 44 44 $this->starFile = new StarFile($this->filename, $this->dirname); 45 45 } 46 46 47 47 /** 48 48 * assure that values are returned as expected 49 * 50 * @test 49 51 */ 50 public function testValues()52 public function values() 51 53 { 52 $this->assertEqual ($this->starFile->getName(), $this->filename);53 $this->assertEqual ($this->starFile->getBaseName(), 'bar.baz');54 $this->assertEqual ($this->starFile->getExtension(), 'baz');55 $this->assertEqual ($this->starFile->getPath(), $this->dirname . DIRECTORY_SEPARATOR . 'foo');56 $this->assertEqual ($this->starFile->getPathWithBaseRemoved(), 'foo');54 $this->assertEquals($this->filename, $this->starFile->getName()); 55 $this->assertEquals('bar.baz', $this->starFile->getBaseName()); 56 $this->assertEquals('baz', $this->starFile->getExtension()); 57 $this->assertEquals($this->dirname . DIRECTORY_SEPARATOR . 'foo', $this->starFile->getPath()); 58 $this->assertEquals('foo', $this->starFile->getPathWithBaseRemoved()); 57 59 } 58 60 59 61 /** 60 62 * assure that the setExtension() method works correct 63 * 64 * @test 61 65 */ 62 public function testSetExtension()66 public function setExtension() 63 67 { 64 68 $this->starFile->setExtension('baz'); 65 $this->assertEqual ($this->starFile->getExtension(), 'baz');66 $this->assertEqual ($this->starFile->getName(), $this->filename);67 $this->assertEqual ($this->starFile->getPathWithBaseRemoved(), 'foo');69 $this->assertEquals('baz', $this->starFile->getExtension()); 70 $this->assertEquals($this->filename, $this->starFile->getName()); 71 $this->assertEquals('foo', $this->starFile->getPathWithBaseRemoved()); 68 72 69 73 $this->starFile->setExtension('foo'); 70 $this->assertEqual ($this->starFile->getExtension(), 'foo');71 $this->assertEqual ($this->starFile->getName(), substr($this->filename, 0, -3) . 'foo');72 $this->assertEqual ($this->starFile->getPathWithBaseRemoved(), 'foo');74 $this->assertEquals('foo', $this->starFile->getExtension()); 75 $this->assertEquals(substr($this->filename, 0, -3) . 'foo', $this->starFile->getName()); 76 $this->assertEquals('foo', $this->starFile->getPathWithBaseRemoved()); 73 77 74 78 $this->starFile->setExtension('bar'); 75 $this->assertEqual ($this->starFile->getExtension(), 'bar');76 $this->assertEqual ($this->starFile->getName(), substr($this->filename, 0, -3) . 'bar');77 $this->assertEqual ($this->starFile->getPathWithBaseRemoved(), 'foo');79 $this->assertEquals('bar', $this->starFile->getExtension()); 80 $this->assertEquals(substr($this->filename, 0, -3) . 'bar', $this->starFile->getName()); 81 $this->assertEquals('foo', $this->starFile->getPathWithBaseRemoved()); 78 82 79 83 $this->starFile->setExtension('baz'); 80 $this->assertEqual ($this->starFile->getExtension(), 'baz');81 $this->assertEqual ($this->starFile->getName(), $this->filename);82 $this->assertEqual ($this->starFile->getPathWithBaseRemoved(), 'foo');84 $this->assertEquals('baz', $this->starFile->getExtension()); 85 $this->assertEquals($this->filename, $this->starFile->getName()); 86 $this->assertEquals('foo', $this->starFile->getPathWithBaseRemoved()); 83 87 } 84 88 } trunk/src/test/php/org/stubbles/star/starTestSuite.php
r124 r1314 1 1 <?php 2 2 /** 3 * Test suite for all classes of net.stubbles.star.3 * Test suite for all classes of org::stubbles::star. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 7 7 * @subpackage test 8 8 */ 9 if (defined('PHPUnit_MAIN_METHOD') === false) { 10 define('PHPUnit_MAIN_METHOD', 'src_test_php_org_stubbles_star_starTestSuite::main'); 11 } 12 13 define('TEST_SRC_PATH', dirname(__FILE__)); 14 require_once TEST_SRC_PATH . '/../../../../../../config/php/config.php'; 15 require_once TEST_SRC_PATH . '/../../../../../main/php/net/stubbles/stubClassLoader.php'; 16 require_once stubConfig::getSourcePath() . '/php/net/stubbles/stubClassLoader.php'; 17 require_once 'PHPUnit/Framework.php'; 18 require_once 'PHPUnit/TextUI/TestRunner.php'; 9 19 /** 10 * Test suite for all classes of net.stubbles.star.20 * Test suite for all classes of org::stubbles::star. 11 21 * 12 22 * @package stubbles 13 23 * @subpackage test 14 24 */ 15 class s tarTestSuite extendsTestSuite25 class src_test_php_org_stubbles_star_starTestSuite extends PHPUnit_Framework_TestSuite 16 26 { 17 27 /** 18 * constructor28 * runs this test suite 19 29 */ 20 public function __construct()30 public static function main() 21 31 { 22 $dir = dirname(__FILE__); 23 $this->TestSuite('Test suite for all classes of net.stubbles.star'); 24 $this->addTestFile($dir . '/StarFileTestCase.php'); 32 PHPUnit_TextUI_TestRunner::run(self::suite()); 33 } 34 35 /** 36 * returns the test suite to be run 37 * 38 * @return PHPUnit_Framework_TestSuite 39 */ 40 public static function suite() 41 { 42 $suite = new self(); 43 $suite->addTestFile(dirname(__FILE__) . '/StarFileTestCase.php'); 44 return $suite; 25 45 } 26 46 } 47 48 if (PHPUnit_MAIN_METHOD === 'src_test_php_org_stubbles_star_starTestSuite::main') { 49 src_test_php_org_stubbles_star_starTestSuite::main(); 50 } 27 51 ?>
