Browse files

Updating the unit tests to reflect new project structure.

  • Loading branch information...
1 parent 7e57bec commit ba3b60cac031dce96f8b28021003fb6765edc48b @zyxist zyxist committed Jun 30, 2011
View
3 tests/TestSuite/AllTests.php
@@ -14,12 +14,13 @@ public static function suite()
{
$suite = new AllTests('TestSuite');
- $suite->addTestSuite('TestSuite\\ClassMapBuilderTest');
$suite->addTestSuite('TestSuite\\GenericLoaderTest');
$suite->addTestSuite('TestSuite\\ClassMapLoaderTest');
$suite->addTestSuite('TestSuite\\PHARLoaderTest');
$suite->addTestSuite('TestSuite\\UniversalLoaderTest');
$suite->addTestSuite('TestSuite\\CoreTrackerTest');
+
+ $suite->addTestSuite('TestSuite\\Toolset\\AllTests');
return $suite;
} // end suite();
View
3 tests/TestSuite/PHARLoaderTest.php
@@ -11,7 +11,7 @@
use RecursiveIteratorIterator;
use RecursiveDirectoryIterator;
use Opl\Autoloader\PHARLoader;
-use Opl\Autoloader\ClassMapBuilder;
+use Opl\Autoloader\Toolset\ClassMapBuilder;
require_once('PHPUnit/Framework/Error.php');
require_once('PHPUnit/Framework/Constraint/IsEqual.php');
require_once('PHPUnit/Runner/BaseTestRunner.php');
@@ -35,6 +35,7 @@ public function setUp()
$builder = new ClassMapBuilder();
$builder->addNamespace('Dummy', './data/');
+ $builder->buildMap();
$phar->setStub(file_get_contents(__DIR__.'/../../src/Opl/Autoloader/PHARLoader.php').'
$loader = new PHARLoader('.var_export($builder->getMap(), true).');
View
11 tests/TestSuite/Toolset/AllTests.php
@@ -6,20 +6,15 @@
* @copyright Copyright (c) 2009 Invenzzia Group
* @license http://www.invenzzia.org/license/new-bsd New BSD License
*/
-namespace TestSuite;
+namespace TestSuite\Toolset;
class AllTests extends \PHPUnit_Framework_TestSuite
{
public static function suite()
{
- $suite = new AllTests('TestSuite');
+ $suite = new AllTests('TestSuite\Toolset');
- $suite->addTestSuite('TestSuite\\ClassMapBuilderTest');
- $suite->addTestSuite('TestSuite\\GenericLoaderTest');
- $suite->addTestSuite('TestSuite\\ClassMapLoaderTest');
- $suite->addTestSuite('TestSuite\\PHARLoaderTest');
- $suite->addTestSuite('TestSuite\\UniversalLoaderTest');
- $suite->addTestSuite('TestSuite\\CoreTrackerTest');
+ $suite->addTestSuite('TestSuite\\Toolset\\ClassMapBuilderTest');
return $suite;
} // end suite();
View
21 tests/TestSuite/Toolset/ClassMapBuilderTest.php
@@ -6,8 +6,8 @@
* @copyright Copyright (c) 2009 Invenzzia Group
* @license http://www.invenzzia.org/license/new-bsd New BSD License
*/
-namespace TestSuite;
-use Opl\Autoloader\ClassMapBuilder;
+namespace TestSuite\Toolset;
+use Opl\Autoloader\Toolset\ClassMapBuilder;
/**
* @covers \Opl\Autoloader\ClassMapBuilder
@@ -19,7 +19,8 @@ public function testParsingNamespace()
{
$builder = new ClassMapBuilder();
- $errors = $builder->addNamespace('Dummy', './data/');
+ $builder->addNamespace('Dummy', './data/');
+ $errors = $builder->buildMap();
$this->assertEquals(array('Not a valid class file: ./data/Dummy/Subdirectory/InvalidFile.php'), $errors);
$this->assertEquals(array(
@@ -36,7 +37,8 @@ public function testAddNamespaceAppendsSlashes()
{
$builder = new ClassMapBuilder();
- $errors = $builder->addNamespace('Dummy', './data');
+ $builder->addNamespace('Dummy', './data');
+ $errors = $builder->buildMap();
$this->assertEquals(array('Not a valid class file: ./data/Dummy/Subdirectory/InvalidFile.php'), $errors);
$this->assertEquals(array(
@@ -53,10 +55,12 @@ public function testAddNamespaceOverwritesOldEntries()
{
$builder = new ClassMapBuilder();
- $errors = $builder->addNamespace('Dummy', './data/');
- $errors = $builder->addNamespace('Dummy2', './data/');
+ $builder->addNamespace('Dummy', './data/');
+ $builder->addNamespace('Dummy2', './data/');
+ $errors = $builder->buildMap();
+
- $this->assertEquals(array(), $errors);
+ $this->assertEquals(array('Not a valid class file: ./data/Dummy/Subdirectory/InvalidFile.php'), $errors);
$this->assertEquals(array(
'Dummy\\ShortFile' => array(0 => 'Dummy2', 1 => 'Dummy2/ShortFile.php'),
'Dummy\\LongFile' => array(0 => 'Dummy', 1 => 'Dummy/LongFile.php'),
@@ -77,7 +81,8 @@ public function testTraitHandling()
{
$builder = new ClassMapBuilder();
- $errors = $builder->addNamespace('TraitTest', './data/');
+ $builder->addNamespace('TraitTest', './data/');
+ $errors = $builder->buildMap();
$this->assertEquals(array(), $errors);
$this->assertEquals(array(

0 comments on commit ba3b60c

Please sign in to comment.