Permalink
Browse files

Adding tests for PSR-0 and old Zend naming conventions in AbstractToo…

…l tests.
  • Loading branch information...
1 parent 2d3e4da commit c8f3877f19a8a11559ff607319eba75a90aaa08f @zyxist zyxist committed Jul 9, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 tests/TestSuite/Toolset/AbstractToolTest.php
@@ -130,6 +130,22 @@ public function testToFilenameReturnsTheClassName()
$this->assertEquals('./foo/src/Foo/Bar/File.php', $tool->toFilename('Foo\\Bar\\File'));
$this->assertEquals('./foo/src/Foo/File/Name.php', $tool->toFilename('Foo\\File_Name'));
} // end testToFilenameReturnsTheClassName();
+
+ public function testToFilenameHandlesPSR0AndZendConventions()
+ {
+ $tool = new DummyTool();
+ $tool->addNamespace('Foo\\Bar', './bar/src/');
+ $tool->addNamespace('Foo_Joe', './joe/src/');
+ $tool->addNamespace('Foo', './foo/src/');
+
+ $this->assertEquals('./foo/src/Foo/File.php', $tool->toFilename('Foo\\File'));
+ $this->assertEquals('./foo/src/Foo/Sub_Namespace/File/Subclass.php', $tool->toFilename('Foo\\Sub_Namespace\\File_Subclass'));
+ $this->assertEquals('./bar/src/Foo/Bar/File.php', $tool->toFilename('Foo\\Bar\\File'));
+ $this->assertEquals('./foo/src/Foo/File/Name.php', $tool->toFilename('Foo\\File_Name'));
+ $this->assertEquals('./bar/src/Foo/Bar/Joe.php', $tool->toFilename('Foo\\Bar_Joe'));
+ $this->assertEquals('./foo/src/Foo/Goo/Hoo.php', $tool->toFilename('Foo_Goo_Hoo'));
+ $this->assertEquals('./joe/src/Foo/Joe/Hoo.php', $tool->toFilename('Foo_Joe_Hoo'));
+ } // end testToFilenameHandlesPSRAndZendConventions();
/**
* @expectedException Opl\Autoloader\Exception\TranslationException

0 comments on commit c8f3877

Please sign in to comment.