我正在运行symfony2内的phpunit,并看到每个日志项输出到标准输出。phpunit monolog控制台输出太详细
我已经从所有config.yml文件中删除了所有monolog处理程序和其他配置条目,所以假设它是symfony-phpunit桥的默认设置或其他。
这是我phpunit.xml.dist:
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://phpunit.de/manual/4.1/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="app/autoload.php"
>
<php>
<ini name="error_reporting" value="-1" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<server name="KERNEL_DIR" value="app/" />
</php>
<listeners>
<listener class="\Mockery\Adapter\Phpunit\TestListener"
file="Mockery/Adapter/Phpunit/TestListener.php">
</listener>
</listeners>
<filter>
<whitelist>
<directory>src</directory>
<exclude>
<directory>src/*Bundle/Resources</directory>
<directory>src/*/*Bundle/Resources</directory>
<directory>src/*/Bundle/*Bundle/Resources</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
上删除该输出任何想法?
ETA,所述测试是使用如下所示的实例化的独白实例:
/**
* @return Logger
*/
protected function getLogger() {
$logger = new Logger('test');
$logger->pushHandler(new DebugHandler);
return $logger;
}
(除去debugHandler没有任何影响)。
它的行为类似于存在输出到标准输出的处理程序,但事实并非如此。下面是一些输出的当我运行的PHPUnit:
Matthews-iMac:api matt$ phpunit ./tests/ONC/Test/Partridge/Import/Importer/ImportStaticTest.php
PHPUnit 5.2.1 by Sebastian Bergmann and contributors.
E..[2016-03-31 12:37:27] test.DEBUG: [PARSE] Could not parse data String could not be parsed as XML <oxip version="7.1" created="2016-02-20 12:05:53" lastMsgId="" requestTime="0.0584"> <response request="getCategories" code="001" message="success" debug="" provider="GENERIC"> <disclaimer></disclaimer> <category id="16" displayOrder="-788" name="Football" category="FOOTBALL"/ <category id="34" displayOrder="-777" name="Tennis" category="TENNIS"/> <category id="23" displayOrder="230" name="Motor Bikes" category="MOTOR_BIKES"/> <category id="36" displayOrder="360" name="Volleyball" category="VOLLEYBALL"/> </responseBROKEN> </oxip> [] []
.[2016-03-31 12:37:27] test.ERROR: [MAPPING] Could not map parsed response to stdClass | feed: CORAL_OPENBET, domain: ONC\Partridge\Entity\Category1, current key with cast: category, current key without cast: category, current result: array ( 'id' => '16', 'displayOrder' => '-788', 'name' => 'Football', 'categoryBELL' => 'FOOTBALL',), mappings: array ( 'name' => 'name', 'category' => 'canonicalised_name', '(int)displayOrder' => 'display_order',), Request: http://xmlfeeds.coral.co.uk/oxi/pub?template=getCategories [] []
你在stdout上看到什么样的日志? – Matteo