| Total Complexity | 4 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class CiffRendererTest extends \PHPUnit_Framework_TestCase |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var CiffRenderer |
||
| 13 | */ |
||
| 14 | private $ciffRenderer; |
||
| 15 | |||
| 16 | public function setUp() |
||
| 17 | { |
||
| 18 | $xmlExpected = simplexml_load_file($this->getXmlPath()); |
||
| 19 | $fontResolver = function () {}; // @codingStandardsIgnoreLine |
||
| 20 | $graphicResolver = function () {}; // @codingStandardsIgnoreLine |
||
| 21 | $argumentValidator = function (\SimpleXMLElement $xmlActual) use ($xmlExpected) { |
||
| 22 | return (string) $xmlExpected == (string) $xmlActual; |
||
| 23 | }; |
||
| 24 | $rendererDocument = m::mock(RendererDocument::class) |
||
| 25 | ->shouldReceive('render') |
||
|
|
|||
| 26 | ->with(m::on($argumentValidator), $fontResolver, $graphicResolver) |
||
| 27 | ->once() |
||
| 28 | ->getMock(); |
||
| 29 | |||
| 30 | $this->ciffRenderer = new CiffRenderer($rendererDocument); |
||
| 31 | $this->ciffRenderer->setFontResolver($fontResolver); |
||
| 32 | $this->ciffRenderer->setGraphicResolver($graphicResolver); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @return string |
||
| 37 | */ |
||
| 38 | private function getXmlPath() |
||
| 39 | { |
||
| 40 | return sprintf('%s/../fixture/document.xml', __DIR__); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function testRenderFile() |
||
| 44 | { |
||
| 45 | $this->ciffRenderer->renderFile($this->getXmlPath()); |
||
| 46 | } |
||
| 47 | |||
| 48 | public function testRenderString() |
||
| 52 | } |
||
| 53 | } |
||
| 54 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.