Comments (6)
Another possibility is the constant DIRECTORY_SEPARATOR
from autoload.
The current implementation should not have this problem anymore. Since i don't have a windows system - and do not plan to sponsor Microsoft when I can help it - I have no way to test it, thus can't close it..
from autoload.
Current status on windows is broken.
But I'm quite sure you'll get a patch from me or @gooh for this
PHPUnit 3.6.3 by Sebastian Bergmann.
Configuration read from C:\Users\Edo\PHP\Autoload\phpunit.xml.dist
F..FF.....SSSSSS...........................
Time: 0 seconds, Memory: 5.75Mb
There were 3 failures:
1) TheSeer\Autoload\Tests\AutoloadBuilderTest::testDefaultRendering
Failed asserting that '<?php
// @codingStandardsIgnoreFile
// @codeCoverageIgnoreStart
// this is an autogenerated file - do not edit
spl_autoload_register(
function($class) {
static $classes = null;
if ($classes === null) {
$classes = array(
'demo1' => 'C:/Users/Edo/PHP/Autoload/tests/_data/classfinder/class.php',
'demo2' => 'C:/Users/Edo/PHP/Autoload/tests/_data/classfinder/class.php'
);
}
$cn = strtolower($class);
if (isset($classes[$cn])) {
require $classes[$cn];
}
}
);
// @codeCoverageIgnoreEnd
' contains " $classes = array(
'demo1' => 'C:\Users\Edo\PHP\Autoload\tests/_data/classfinder/class.php',
".
C:\meine\PHP\pear\PHPUnit\Framework\Constraint.php:141
C:\meine\PHP\pear\PHPUnit\Framework\Constraint.php:92
C:\meine\PHP\pear\PHPUnit\Framework\Assert.php:2100
C:\meine\PHP\pear\PHPUnit\Framework\Assert.php:140
C:\Users\Edo\PHP\Autoload\tests\autoloadbuilder.test.php:67
C:\meine\PHP\pear\PHPUnit\Framework\TestCase.php:918
C:\meine\PHP\pear\PHPUnit\Framework\TestCase.php:780
C:\meine\PHP\pear\PHPUnit\Framework\TestResult.php:649
C:\meine\PHP\pear\PHPUnit\Framework\TestCase.php:727
C:\meine\PHP\pear\PHPUnit\Framework\TestSuite.php:772
C:\meine\PHP\pear\PHPUnit\Framework\TestSuite.php:745
C:\meine\PHP\pear\PHPUnit\Framework\TestSuite.php:705
C:\meine\PHP\pear\PHPUnit\TextUI\TestRunner.php:325
C:\meine\PHP\pear\PHPUnit\TextUI\Command.php:187
C:\meine\PHP\pear\PHPUnit\TextUI\Command.php:125
C:\meine\PHP\phpunit:44
2) TheSeer\Autoload\Tests\AutoloadBuilderTest::testSettingNonDefaultTemplate
Failed asserting that '<?php
'demo1' => 'C:/Users/Edo/PHP/Autoload/tests/_data/classfinder/class.php',
'demo2' => 'C:/Users/Edo/PHP/Autoload/tests/_data/classfinder/class.php'
?>' contains "'demo1' => 'C:\Users\Edo\PHP\Autoload\tests/_data/classfinder/class.php',
".
C:\meine\PHP\pear\PHPUnit\Framework\Constraint.php:141
C:\meine\PHP\pear\PHPUnit\Framework\Constraint.php:92
C:\meine\PHP\pear\PHPUnit\Framework\Assert.php:2100
C:\meine\PHP\pear\PHPUnit\Framework\Assert.php:140
C:\Users\Edo\PHP\Autoload\tests\autoloadbuilder.test.php:102
C:\meine\PHP\pear\PHPUnit\Framework\TestCase.php:918
C:\meine\PHP\pear\PHPUnit\Framework\TestCase.php:780
C:\meine\PHP\pear\PHPUnit\Framework\TestResult.php:649
C:\meine\PHP\pear\PHPUnit\Framework\TestCase.php:727
C:\meine\PHP\pear\PHPUnit\Framework\TestSuite.php:772
C:\meine\PHP\pear\PHPUnit\Framework\TestSuite.php:745
C:\meine\PHP\pear\PHPUnit\Framework\TestSuite.php:705
C:\meine\PHP\pear\PHPUnit\TextUI\TestRunner.php:325
C:\meine\PHP\pear\PHPUnit\TextUI\Command.php:187
C:\meine\PHP\pear\PHPUnit\TextUI\Command.php:125
C:\meine\PHP\phpunit:44
3) TheSeer\Autoload\Tests\AutoloadBuilderTest::testSettingTemplateCode
Failed asserting that ''demo1' => 'C:/Users/Edo/PHP/Autoload/tests/_data/classfinder/class.php',
'demo2' => 'C:/Users/Edo/PHP/Autoload/tests/_data/classfinder/class.php'' contains "'demo1' => 'C:\Users\Edo\PHP\Autoload\tests/_data/classfinder/class.php',
".
C:\meine\PHP\pear\PHPUnit\Framework\Constraint.php:141
C:\meine\PHP\pear\PHPUnit\Framework\Constraint.php:92
C:\meine\PHP\pear\PHPUnit\Framework\Assert.php:2100
C:\meine\PHP\pear\PHPUnit\Framework\Assert.php:140
C:\Users\Edo\PHP\Autoload\tests\autoloadbuilder.test.php:113
C:\meine\PHP\pear\PHPUnit\Framework\TestCase.php:918
C:\meine\PHP\pear\PHPUnit\Framework\TestCase.php:780
C:\meine\PHP\pear\PHPUnit\Framework\TestResult.php:649
C:\meine\PHP\pear\PHPUnit\Framework\TestCase.php:727
C:\meine\PHP\pear\PHPUnit\Framework\TestSuite.php:772
C:\meine\PHP\pear\PHPUnit\Framework\TestSuite.php:745
C:\meine\PHP\pear\PHPUnit\Framework\TestSuite.php:705
C:\meine\PHP\pear\PHPUnit\TextUI\TestRunner.php:325
C:\meine\PHP\pear\PHPUnit\TextUI\Command.php:187
C:\meine\PHP\pear\PHPUnit\TextUI\Command.php:125
C:\meine\PHP\phpunit:44
FAILURES!
Tests: 38, Assertions: 75, Failures: 3, Skipped: 6.
Writing code coverage data to XML file, this may take a moment.
Generating code coverage report, this may take a moment.
from autoload.
Any updates you windows people? :)
from autoload.
Heh, forgot about this one..
Non of the solution really looks nice to be honest.
Ether using lots of DIRECTORY_SEPARATORs or replacing all \ with / before comparing. The latter seems a little more doable.
I've seen the problem in more testsuites so far and I'm still pondering wether or not to suggest a assertSamePath or something but that doesn't help here ether :)
C:\Users\Edo\PHP\Autoload>git diff
diff --git a/tests/autoloadbuilder.test.php b/tests/autoloadbuilder.test.php
index c9aab17..e2a521d 100644
--- a/tests/autoloadbuilder.test.php
+++ b/tests/autoloadbuilder.test.php
@@ -64,6 +64,7 @@ namespace TheSeer\Autoload\Tests {
public function testDefaultRendering() {
$ab = new \TheSeer\Autoload\AutoloadBuilder($this->classlist);
$expected = " \$classes = array(\n 'demo1' =
+ $expected = strtr($expected, '\\', '/');
$this->assertContains($expected, $ab->render());
$expected = "require \$classes[\$cn]";
$this->assertContains($expected, $ab->render());
@@ -99,6 +100,7 @@ namespace TheSeer\Autoload\Tests {
$ab = new \TheSeer\Autoload\AutoloadBuilder($this->classlist);
$ab->setTemplateFile(__DIR__ . '/_data/templates/simple.php');
$expected = "'demo1' => '".__DIR__."/_data/classfinder/class.php',\
+ $expected = strtr($expected, '\\', '/');
$this->assertContains($expected, $ab->render());
}
@@ -110,6 +112,7 @@ namespace TheSeer\Autoload\Tests {
$ab = new \TheSeer\Autoload\AutoloadBuilder($this->classlist);
$ab->setTemplateCode('___CLASSLIST___');
$expected = "'demo1' => '".__DIR__."/_data/classfinder/class.php',\
+ $expected = strtr($expected, '\\', '/');
$this->assertContains($expected, $ab->render());
}
@@ -160,6 +163,7 @@ namespace TheSeer\Autoload\Tests {
$result = $ab->render();
$expected = "require __DIR__ . \$classes[\$cn];";
+ $expected = strtr($expected, '\\', '/');
$this->assertContains($expected, $result);
$expected = " \$classes = array(\n 'demo1' =
is the nicest thing I could come up with. If you want to apply that I'll send you a pull request
from autoload.
The patch looks okay to me, even though it''s sad we seem to have to mess with the expected values to make things work on windows. So yes, please make this a pull request.
from autoload.
Related Issues (20)
- CI: move to GH Actions ? HOT 2
- Deprecation warning when running on PHP 8.2 HOT 2
- Integration within Box HOT 7
- Exclude directory HOT 2
- Make `--phar` reproducible HOT 34
- Add option to handle duplicate declarations across multiple files HOT 2
- Do not bail out on first duplicate code unit HOT 1
- evaluate introducing an "opcache prewarm list" HOT 1
- Add support for Composer's autolaoder and adding autoloading in code HOT 3
- Error with recursive Composer dependencies HOT 1
- Dep missing in Readme
- symfony/event-dispatcher Duplicate definitions of the following unit(s) found HOT 2
- `__halt_compiler` detection HOT 7
- Warnings and Notices in ComposerIterator
- Zeta Components ConsoleTools uses PHP syntax deprecated in PHP 7.4 HOT 1
- PHPAB 1.25.7 generates broken PHAR for PHPUnit
- Functions HOT 5
- Adopt, if needed, to PHP 8's T_NAME_FULLY_QUALIFIED, T_NAME_RELATIVE, and T_NAME_QUALIFIED tokens HOT 3
- Can't generate autoloader for nikic/php-parser HOT 2
- Array to string conversion on parsing composer.json HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autoload.