2013-06-20 11 views
5

से अजीब आउटपुट मैंने पीईआर के माध्यम से PHPUnit स्थापित किया है, और मैंने वर्डप्रेस प्लगइन टेस्ट (https://github.com/tierra/wordpress-plugin-tests) स्थापित किया है ताकि विकास के तहत मेरे वर्डप्रेस प्लगइन का परीक्षण किया जा सके।PHPUnit

मुद्दा यह है कि जबकि परीक्षण रन normaly, मैं निम्नलिखित उत्पादन हो रही है:

Running as single site... To run multisite, use -c multisite.xml 
Not running ajax tests... To execute these, use --group ajax. 
PHPUnit 3.7.21 by Sebastian Bergmann. 

Configuration read from E:\LocalWebServer\dch\c\my-wp-installtion.dch\wordpress-test\wordpress\wp-content\plugins\myplugin\phpunit.xml 

[41;37mF[0m.[36;1mS[0m 

Time : 1 second, Memory: 30.50Mb 

There was 1 failure: 

1) CDOAjax_Tests::test_tests 
Failed asserting that false is true. 

E:\LocalWebServer\dch\c\my-wp-installtion.dch\wordpress-test\wordpress\wp-content\plugins\myplugin\Tests\test_CDOAjax_tests.php:7 

[37;41m[2KFAILURES! 
[0m[37;41m[2KTests: 3, Assertions: 2, Failures: 1, Skipped: 1. 
[0m[2K 

कि अगर मदद करता है मैं नहीं जानता, लेकिन phpunit.xml निम्नलिखित शामिल हैं:

<phpunit 
bootstrap="bootstrap_tests.php" 
backupGlobals="false" 
colors="true" 
> 
    <testsuites> 
     <!-- Default test suite to run all tests --> 
     <testsuite name="cabdriver"> 
      <directory prefix="test_" suffix=".php">tests</directory> 
     </testsuite> 
    </testsuites> 
</phpunit> 

जैसा कि आप देख सकते हैं, PHPUnit आउटपुट में कुछ अजीब वर्ण हैं, जैसे कि अंतिम पंक्ति जिसमें [0m [2k।

मेरे प्रणाली एक विंडोज 7 और मैं नाशपाती

तो के माध्यम से स्थापित PHPUnit साथ XAMPP चलाने के लिए, मैं किसी भी तरह कि इस मुद्दे को ठीक कर सकते हैं, क्योंकि उत्पादन को पढ़ने के लिए इतना स्पष्ट नहीं है।

तरह

+1

ऐसा लगता है कि रंग कोड ठीक से नहीं बच रहे हैं, जो आपके खोल से संबंधित है। आपका खोल क्या है, और आप किस टर्मिनल एप्लिकेशन का उपयोग कर रहे हैं? –

+0

जैसा कि मैंने उपरोक्त वर्णन किया है, यह विंडोज 7 पर एक सीएमडी कंसोल है, धन्यवाद :) –

+1

और आपका खोल? –

उत्तर

12

का संबंध उन यूनिक्स शान्ति के लिए रंग कोड होते हैं और वे कठिन PHPUnit ढांचे में कोडित रहे हैं के रूप में आप देख सकते हैं: https://github.com/sebastianbergmann/phpunit/blob/master/PHPUnit/TextUI/ResultPrinter.php

उदाहरण: लाइनों 500 509.

public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) 
    { 
     if ($this->colors) { 
      $this->writeProgress("\x1b[31;1mE\x1b[0m"); 
     } else { 
      $this->writeProgress('E'); 
     } 

     $this->lastTestFailed = TRUE; 
    } 
को

मेरा मानना ​​है कि आप अपनी phpunit.xml फ़ाइल में विशेषता रंग = "झूठी" सेटिंग रंगों को छुपा सकते हैं:

<phpunit colors="false"> 
    <!-- ... --> 
</phpunit> 

आप यहां और अधिक पढ़ सकते हैं: http://phpunit.de/manual/3.7/en/appendixes.configuration.html

+0

गिथब लिंक 404 – Madbreaks