| @@ 15-32 (lines=18) @@ | ||
| 12 | * Class CloverTest |
|
| 13 | * @package Tests\Unit\Proxy |
|
| 14 | */ |
|
| 15 | class CloverTest extends BaseUnitTestCase |
|
| 16 | { |
|
| 17 | public function testWriteToFile() |
|
| 18 | { |
|
| 19 | $targetFile = new OutputFile(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'clover.xml'); |
|
| 20 | $text = new Clover($targetFile); |
|
| 21 | ||
| 22 | $this->assertFileNotExists($targetFile->getFilePath()); |
|
| 23 | ||
| 24 | $text->process($this->createCodeCoverage()); |
|
| 25 | ||
| 26 | $content = $this->getFileContent($targetFile->getFilePath()); |
|
| 27 | unlink($targetFile->getFilePath()); |
|
| 28 | $this->assertStringStartsWith('<?xml', $content); |
|
| 29 | $this->assertContains('<coverage generated=', $content); |
|
| 30 | $this->assertContains('</coverage>', $content); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 15-32 (lines=18) @@ | ||
| 12 | * Class Crap4jTest |
|
| 13 | * @package Tests\Unit\Coverage\Processor |
|
| 14 | */ |
|
| 15 | class Crap4jTest extends BaseUnitTestCase |
|
| 16 | { |
|
| 17 | public function testWriteToFile() |
|
| 18 | { |
|
| 19 | $targetFile = new OutputFile(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'crap4j.xml'); |
|
| 20 | $text = new Crap4j($targetFile); |
|
| 21 | ||
| 22 | $this->assertFileNotExists($targetFile->getFilePath()); |
|
| 23 | ||
| 24 | $text->process($this->createCodeCoverage()); |
|
| 25 | ||
| 26 | $content = $this->getFileContent($targetFile->getFilePath()); |
|
| 27 | unlink($targetFile->getFilePath()); |
|
| 28 | $this->assertStringStartsWith('<?xml', $content); |
|
| 29 | $this->assertContains('<crap_result>', $content); |
|
| 30 | $this->assertContains('</crap_result>', $content); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| @@ 15-32 (lines=18) @@ | ||
| 12 | * Class PhpTest |
|
| 13 | * @package Tests\Unit\Coverage\Processor |
|
| 14 | */ |
|
| 15 | class PhpTest extends BaseUnitTestCase |
|
| 16 | { |
|
| 17 | public function testWriteToFile() |
|
| 18 | { |
|
| 19 | $targetFile = new OutputFile(sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'coverage.php'); |
|
| 20 | $text = new Php($targetFile); |
|
| 21 | ||
| 22 | $this->assertFileNotExists($targetFile->getFilePath()); |
|
| 23 | ||
| 24 | $text->process($this->createCodeCoverage()); |
|
| 25 | ||
| 26 | $content = $this->getFileContent($targetFile->getFilePath()); |
|
| 27 | unlink($targetFile->getFilePath()); |
|
| 28 | $this->assertStringStartsWith('<?php', $content); |
|
| 29 | $this->assertContains('$coverage = new', $content); |
|
| 30 | $this->assertContains('return $coverage;', $content); |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||