From bb3204c716f7148065c2f819e2bb6c0377bd53cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Tue, 30 Apr 2019 14:14:58 +0200 Subject: [PATCH] [Tests] Add more debug on failure for methodCallCountConstraint added in #75 --- .../FieldType/Converter/MethodCallCountConstraint.php | 9 +++++---- tests/lib/FieldType/Converter/RichTextTest.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/lib/FieldType/Converter/MethodCallCountConstraint.php b/tests/lib/FieldType/Converter/MethodCallCountConstraint.php index dd24af45..10fe9dc6 100644 --- a/tests/lib/FieldType/Converter/MethodCallCountConstraint.php +++ b/tests/lib/FieldType/Converter/MethodCallCountConstraint.php @@ -73,17 +73,18 @@ public function toString() * * @throws PHPUnit_Framework_ExpectationFailedException */ - public function verify() + public function verify($test = null) { $count = $this->getInvocationCount(); if ($count != $this->expectedCount) { - throw new PHPUnit_Framework_ExpectationFailedException( + throw new ExpectationFailedException( sprintf( 'Methods of class was expected to be called %d times, ' . - 'actually called %d times.', + 'actually called %d times.' . ($test ? "\nWhile testing '%s'." : ''), $this->expectedCount, - $count + $count, + $test ) ); } diff --git a/tests/lib/FieldType/Converter/RichTextTest.php b/tests/lib/FieldType/Converter/RichTextTest.php index a66b52e5..02187f02 100644 --- a/tests/lib/FieldType/Converter/RichTextTest.php +++ b/tests/lib/FieldType/Converter/RichTextTest.php @@ -232,7 +232,7 @@ public function testConvert($inputFilePath, $outputFilePath, $logFilePath) $richText->setImageContentTypes([27]); $result = $richText->convert($inputDocument, true, true); - $this->methodCallCountConstraint->verify(); + $this->methodCallCountConstraint->verify(basename($inputFilePath)); if ($result === false && !file_exists($outputFilePath)) { return;