[limb-svn] r7129 - in 3.x/trunk/limb/bundle: src tests/cases
svn at limb-project.com
svn at limb-project.com
Tue Jul 22 19:23:24 MSD 2008
Author: conf
Date: 2008-07-22 19:23:24 +0400 (Tue, 22 Jul 2008)
New Revision: 7129
URL: http://fisheye.limb-project.com/changelog/limb/?cs=7129
Modified:
3.x/trunk/limb/bundle/src/lmbBundler.class.php
3.x/trunk/limb/bundle/tests/cases/lmbBundlerTest.class.php
Log:
-- fixed lmbBundler errors on windows platform
-- fixed lmbBundlerTest
Modified: 3.x/trunk/limb/bundle/src/lmbBundler.class.php
===================================================================
--- 3.x/trunk/limb/bundle/src/lmbBundler.class.php 2008-07-22 12:32:13 UTC (rev 7128)
+++ 3.x/trunk/limb/bundle/src/lmbBundler.class.php 2008-07-22 15:23:24 UTC (rev 7129)
@@ -1,5 +1,7 @@
<?php
+require_once('limb/core/common.inc.php');
+
class lmbBundler
{
static public $regexp_for_requires = '/^\s*((lmb_)?require(_once)?)\s*\([\'|\"]([a-zA-z0-9\-_.\/]+).*$/m';
@@ -9,7 +11,7 @@
function __construct($include_path, $verbose = false)
{
- $this->include_paths = explode(':', $include_path);
+ $this->include_paths = explode(PATH_SEPARATOR, $include_path);
foreach($this->include_paths as $key => $path)
{
if(!strlen($path))
@@ -42,11 +44,8 @@
{
$full_path = $include_path . '/' . $file;
- if(!file_exists($full_path)) {
- continue;
- } else {
- $file_path = $full_path;
- break;
+ if(file_exists($full_path)) {
+ return $full_path;
}
}
@@ -55,7 +54,8 @@
function isPathAbsolute($path)
{
- return ('/' === $path{0});
+ //return ('/' === $path{0});
+ return lmb_is_path_absolute($path);
}
function add($file)
@@ -127,8 +127,8 @@
echo $without_tags ? '' : "<?php\n";
foreach(array_unique($this->_includes) as $file)
{
- echo "//-----------".$file."------------".PHP_EOL;
+// echo "//-----------".$file."------------".PHP_EOL;
echo self::cleanUpFile($file);
}
}
-}
\ No newline at end of file
+}
Modified: 3.x/trunk/limb/bundle/tests/cases/lmbBundlerTest.class.php
===================================================================
--- 3.x/trunk/limb/bundle/tests/cases/lmbBundlerTest.class.php 2008-07-22 12:32:13 UTC (rev 7128)
+++ 3.x/trunk/limb/bundle/tests/cases/lmbBundlerTest.class.php 2008-07-22 15:23:24 UTC (rev 7129)
@@ -8,7 +8,7 @@
function __construct()
{
- $this->fixture_dir = dirname(__FILE__).'/../fixture/';
+ $this->fixture_dir = realpath(dirname(__FILE__).'/../fixture') . DIRECTORY_SEPARATOR;
}
function testGetDependenciesFromFile()
@@ -39,7 +39,7 @@
$includes = $bundler->getIncludes();
$this->assertEqual(5, count($includes));
- $this->assertTrue(strpos($includes[0], './require.php'));
+ $this->assertTrue(strpos($includes[0], 'require.php'));
$this->assertTrue(false !== strpos($includes[0], $this->fixture_dir));
$this->assertTrue(strpos($includes[1], 'require_once.php'));
$this->assertTrue(false !== strpos($includes[1], $this->fixture_dir));
@@ -78,13 +78,13 @@
$includes = $bundler->getIncludes();
$this->assertEqual(4, count($includes));
- $this->assertTrue(strpos($includes[0], './require.php'));
+ $this->assertEqual($includes[0], $this->fixture_dir . 'require.php');
$this->assertTrue(false === strpos($includes[0], $fixture_sub_folder));
}
function testGetNewDependencies_properlyResolveIncludePaths_findNotInFirstIncludePath()
{
- $fixture_sub_folder = $this->fixture_dir . '/subfolder/';
+ $fixture_sub_folder = realpath($this->fixture_dir . '/subfolder') . DIRECTORY_SEPARATOR;
$bundler = new lmbBundler($include_path = $this->fixture_dir . PATH_SEPARATOR . $fixture_sub_folder);
@@ -94,7 +94,7 @@
$includes = $bundler->getIncludes();
$this->assertEqual(2, count($includes));
- $this->assertTrue(strpos($includes[0], 'sub_folder.php'));
+ $this->assertEqual($includes[0], $fixture_sub_folder . 'sub_folder.php');
$this->assertTrue(false !== strpos($includes[0], $fixture_sub_folder));
}
More information about the limb-svn
mailing list