Skip to content

Commit 49ffd34

Browse files
Add tests
1 parent 2b81090 commit 49ffd34

11 files changed

+287
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage\Test\Target;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(InvalidCodeCoverageTargetException::class)]
17+
#[Small]
18+
final class InvalidCodeCoverageTargetExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
/** @phpstan-ignore argument.type */
23+
$e = new InvalidCodeCoverageTargetException(Target::forClass('DoesNotExist'));
24+
25+
$this->assertSame('Class DoesNotExist is not a valid target for code coverage', $e->getMessage());
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(NoCodeCoverageDriverAvailableException::class)]
17+
#[Small]
18+
final class NoCodeCoverageDriverAvailableExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
$e = new NoCodeCoverageDriverAvailableException;
23+
24+
$this->assertSame('No code coverage driver available', $e->getMessage());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(NoCodeCoverageDriverWithPathCoverageSupportAvailableException::class)]
17+
#[Small]
18+
final class NoCodeCoverageDriverWithPathCoverageSupportAvailableExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
$e = new NoCodeCoverageDriverWithPathCoverageSupportAvailableException;
23+
24+
$this->assertSame('No code coverage driver with path coverage support available', $e->getMessage());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(PathExistsButIsNotDirectoryException::class)]
17+
#[Small]
18+
final class PathExistsButIsNotDirectoryExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
$e = new PathExistsButIsNotDirectoryException('/not/a/directory');
23+
24+
$this->assertSame('"/not/a/directory" exists but is not a directory', $e->getMessage());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage\Driver;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(PcovNotAvailableException::class)]
17+
#[Small]
18+
final class PcovNotAvailableExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
$e = new PcovNotAvailableException;
23+
24+
$this->assertSame('The PCOV extension is not available', $e->getMessage());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(ReportAlreadyFinalizedException::class)]
17+
#[Small]
18+
final class ReportAlreadyFinalizedExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
$e = new ReportAlreadyFinalizedException;
23+
24+
$this->assertSame('The code coverage report has already been finalized', $e->getMessage());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(TestIdMissingException::class)]
17+
#[Small]
18+
final class TestIdMissingExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
$e = new TestIdMissingException;
23+
24+
$this->assertSame('Test ID is missing', $e->getMessage());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(WriteOperationFailedException::class)]
17+
#[Small]
18+
final class WriteOperationFailedExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
$e = new WriteOperationFailedException('/path');
23+
24+
$this->assertSame('Cannot write to "/path"', $e->getMessage());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage\Driver;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(XdebugNotAvailableException::class)]
17+
#[Small]
18+
final class XdebugNotAvailableExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
$e = new XdebugNotAvailableException;
23+
24+
$this->assertSame('The Xdebug extension is not available', $e->getMessage());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage\Driver;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(XdebugNotEnabledException::class)]
17+
#[Small]
18+
final class XdebugNotEnabledExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
$e = new XdebugNotEnabledException;
23+
24+
$this->assertSame('XDEBUG_MODE=coverage (environment variable) or xdebug.mode=coverage (PHP configuration setting) has to be set', $e->getMessage());
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage\Driver;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\Attributes\Small;
14+
use PHPUnit\Framework\TestCase;
15+
16+
#[CoversClass(XdebugVersionNotSupportedException::class)]
17+
#[Small]
18+
final class XdebugVersionNotSupportedExceptionTest extends TestCase
19+
{
20+
public function testHasMessage(): void
21+
{
22+
$e = new XdebugVersionNotSupportedException('1.2.3');
23+
24+
$this->assertSame('Version 1.2.3 of the Xdebug extension is not supported', $e->getMessage());
25+
}
26+
}

0 commit comments

Comments
 (0)