Coder Social home page Coder Social logo

Comments (6)

adriankirchner avatar adriankirchner commented on September 18, 2024

Another possibility is the constant DIRECTORY_SEPARATOR

from autoload.

theseer avatar theseer commented on September 18, 2024

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.

edorian avatar edorian commented on September 18, 2024

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.

theseer avatar theseer commented on September 18, 2024

Any updates you windows people? :)

from autoload.

edorian avatar edorian commented on September 18, 2024

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.

theseer avatar theseer commented on September 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.