#やりたい事
以下のライブラリをLaraveのプロジェクトに導入したいと考えています。
https://github.com/nunomaduro/collision
Artisanコマンドのエラー表示をいい感じにしてくれるらしいです。
#実施したこと
上記URLのREADMEに書かれた通りの事を実施しました。
①composerでインストール
composer require nunomaduro/collision --dev
②phpunit.xml
に<listeners>
を追加
xml
1<?xml version="1.0" encoding="UTF-8"?> 2<phpunit backupGlobals="false" 3 backupStaticAttributes="false" 4 bootstrap="bootstrap/autoload.php" 5 colors="true" 6 convertErrorsToExceptions="true" 7 convertNoticesToExceptions="true" 8 convertWarningsToExceptions="true" 9 processIsolation="false" 10 stopOnFailure="false"> 11 <testsuites> 12 <testsuite name="Feature Tests"> 13 <directory suffix="Test.php">./tests/Feature</directory> 14 </testsuite> 15 16 <testsuite name="Unit Tests"> 17 <directory suffix="Test.php">./tests/Unit</directory> 18 </testsuite> 19 </testsuites> 20 <filter> 21 <whitelist processUncoveredFilesFromWhitelist="true"> 22 <directory suffix=".php">./app</directory> 23 </whitelist> 24 </filter> 25 <!-- この部分を追加 --> 26 <listeners> 27 <listener class="NunoMaduro\Collision\Adapters\Phpunit\Listener" /> 28 </listeners> 29 <!-- この部分を追加 --> 30 <php> 31 <env name="APP_ENV" value="testing"/> 32 <env name="CACHE_DRIVER" value="array"/> 33 <env name="SESSION_DRIVER" value="array"/> 34 <env name="QUEUE_DRIVER" value="sync"/> 35 </php> 36</phpunit> 37
#エラー
上記実施後phpunit
コマンドを実行したら以下のエラーが出ました。
PHP Fatal error: Declaration of NunoMaduro\Collision\Adapters\Phpunit\Listener::addError(PHPUnit\Framework\Test $test, Exception $e, $time) must be compatible with PHPUnit_Framework_TestListener::addError(PHPUnit_Framework_Test $test, Exception $e, $time) in /home/vagrant/Code/Laravel/vendor/nunomaduro/collision/src/Adapters/Phpunit/Listener.php on line 33
Listener.php on line 33
とあるので、該当のファイルを開きましたがどうにも対処法が思い浮かびませんでした。。
php
1//Listener.php 33行目付近まで 2 3<?php 4 5/** 6 * This file is part of Collision. 7 * 8 * (c) Nuno Maduro <enunomaduro@gmail.com> 9 * 10 * For the full copyright and license information, please view the LICENSE 11 * file that was distributed with this source code. 12 */ 13 14namespace NunoMaduro\Collision\Adapters\Phpunit; 15 16use Exception; 17use ReflectionObject; 18use PHPUnit\Framework\Test; 19use PHPUnit\Framework\Warning; 20use Whoops\Exception\Inspector; 21use NunoMaduro\Collision\Writer; 22use PHPUnit\Framework\TestSuite; 23use Symfony\Component\Console\Application; 24use PHPUnit\Framework\AssertionFailedError; 25use Symfony\Component\Console\Input\ArgvInput; 26use Symfony\Component\Console\Output\ConsoleOutput; 27use NunoMaduro\Collision\Contracts\Writer as WriterContract; 28use NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener as ListenerContract; 29 30/** 31 * This is an Collision Phpunit Adapter implementation. 32 * 33 * @author Nuno Maduro <enunomaduro@gmail.com> 34 */ 35class Listener implements ListenerContract 36{ 37 /** 38 * Holds an instance of the writer. 39 * 40 * @var \NunoMaduro\Collision\Contracts\Writer 41 */ 42 protected $writer; 43 44 //以下省略
もしお分かりになる方いらっしゃいましたらご教示頂けますと幸いです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/10/24 01:38