Skip to content

Commit

Permalink
Add code coverage attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno committed Apr 24, 2024
1 parent ee9dc1e commit 08dee16
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.phpunit.cache
composer.phar
/vendor/

Expand Down
23 changes: 23 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
2 changes: 2 additions & 0 deletions tests/Channel/PearChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

namespace Pickling\Test\Channel;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Pickling\Channel\ChannelInterface;
use Pickling\Channel\PearChannel;

#[CoversClass(PearChannel::class)]
final class PearChannelTest extends TestCase {
public function testGetUrl(): void {
$pear = new PearChannel();
Expand Down
2 changes: 2 additions & 0 deletions tests/Channel/PeclChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

namespace Pickling\Test\Channel;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Pickling\Channel\ChannelInterface;
use Pickling\Channel\PeclChannel;

#[CoversClass(PeclChannel::class)]
final class PeclChannelTest extends TestCase {
public function testGetUrl(): void {
$pecl = new PeclChannel();
Expand Down
2 changes: 2 additions & 0 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Pickling\Test;

use Nyholm\Psr7\Factory\Psr17Factory;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Pickling\Channel\PeclChannel;
use Pickling\Client;
Expand All @@ -13,6 +14,7 @@
use Psr\Http\Message\ResponseInterface;
use PsrMock\Psr18\Client as MockClient;

#[CoversClass(Client::class)]
final class ClientTest extends TestCase {
private MockClient $httpClient;
private Psr17Factory $psr17Factory;
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/CategoryListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

namespace Pickling\Test\Resource;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Pickling\Resource\CategoryList;
use SimpleXMLElement;

#[CoversClass(CategoryList::class)]
final class CategoryListTest extends TestCase {
public function testPropertyGetters(): void {
$content = file_get_contents(__DIR__ . '/../Fixtures/categories.xml');
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/Feed/CategoryFeedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

namespace Pickling\Test\Resource\Feed;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Pickling\Resource\Feed\Category;
use Pickling\Resource\Feed\Item;
use SimpleXMLElement;

#[CoversClass(Category::class)]
final class CategoryFeedTest extends TestCase {
#[DataProvider('propertyGettersDataProvider')]
public function testPropertyGetters(string $file, array $properties): void {
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/Feed/PackageFeedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

namespace Pickling\Test\Resource\Feed;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Pickling\Resource\Feed\Item;
use Pickling\Resource\Feed\Package;
use SimpleXMLElement;

#[CoversClass(Package::class)]
final class PackageFeedTest extends TestCase {
#[DataProvider('propertyGettersDataProvider')]
public function testPropertyGetters(string $file, array $properties): void {
Expand Down
10 changes: 6 additions & 4 deletions tests/Resource/Package/InfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

namespace Pickling\Test\Resource\Package;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Pickling\Resource\Package\Info;
use SimpleXMLElement;

#[CoversClass(Info::class)]
final class InfoTest extends TestCase {
#[DataProvider('propertyGettersDataProvider')]
public function testPropertyGetters(string $file, array $properties): void {
Expand All @@ -30,7 +32,7 @@ public function testPropertyGetters(string $file, array $properties): void {

public static function propertyGettersDataProvider(): array {
return [
[
'amqp' => [
'/../../Fixtures/amqp/info.xml',
[
'amqp',
Expand All @@ -46,7 +48,7 @@ public static function propertyGettersDataProvider(): array {
''
]
],
[
'mongo' => [
'/../../Fixtures/mongo/info.xml',
[
'mongo',
Expand All @@ -62,7 +64,7 @@ public static function propertyGettersDataProvider(): array {
''
]
],
[
'mongodb' => [
'/../../Fixtures/mongodb/info.xml',
[
'mongodb',
Expand All @@ -82,7 +84,7 @@ public static function propertyGettersDataProvider(): array {
''
]
],
[
'parallel' => [
'/../../Fixtures/parallel/info.xml',
[
'parallel',
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/Package/Release/InfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

namespace Pickling\Test\Resource\Package\Release;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Pickling\Resource\Package\Release\Info;
use SimpleXMLElement;

#[CoversClass(Info::class)]
final class InfoTest extends TestCase {
#[DataProvider('propertyGettersDataProvider')]
public function testPropertyGetters(string $file, array $properties): void {
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/Package/Release/ManifestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

namespace Pickling\Test\Resource\Package\Release;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Pickling\Resource\Package\Release\Manifest;
use SimpleXMLElement;

#[CoversClass(Manifest::class)]
final class ManifestTest extends TestCase {
#[DataProvider('propertyGettersDataProvider')]
public function testPropertyGetters(string $file, array $properties): void {
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/Package/Release/VersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

namespace Pickling\Test\Resource\Package\Release;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Pickling\Resource\Package\Release\Version;
use SimpleXMLElement;

#[CoversClass(Version::class)]
final class VersionTest extends TestCase {
public function testPropertyGetters(): void {
$version = new Version(
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/Package/ReleaseListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@

namespace Pickling\Test\Resource\Package;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Pickling\Resource\Package\Release\Version;
use Pickling\Resource\Package\ReleaseList;
use SimpleXMLElement;

#[CoversClass(ReleaseList::class)]
final class ReleaseListTest extends TestCase {
#[DataProvider('propertyGettersDataProvider')]
public function testPropertyGetters(string $file, array $properties): void {
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/Package/ReleaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Pickling\Test\Resource\Package;

use Nyholm\Psr7\Factory\Psr17Factory;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Pickling\Channel\PeclChannel;
use Pickling\Resource\Package\Release;
Expand All @@ -12,6 +13,7 @@
use Psr\Http\Message\ResponseInterface;
use PsrMock\Psr18\Client as MockClient;

#[CoversClass(Release::class)]
final class ReleaseTest extends TestCase {
private MockClient $httpClient;
private Psr17Factory $psr17Factory;
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/PackageListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

namespace Pickling\Test\Resource;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Pickling\Resource\PackageList;
use SimpleXMLElement;

#[CoversClass(PackageList::class)]
final class PackageListTest extends TestCase {
public function testPropertyGetters(): void {
$content = file_get_contents(__DIR__ . '/../Fixtures/packages.xml');
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/PackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Pickling\Test\Resource;

use Nyholm\Psr7\Factory\Psr17Factory;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Pickling\Channel\PeclChannel;
use Pickling\Resource\Package;
Expand All @@ -13,6 +14,7 @@
use Psr\Http\Message\ResponseInterface;
use PsrMock\Psr18\Client as MockClient;

#[CoversClass(Package::class)]
final class PackageTest extends TestCase {
private MockClient $httpClient;
private Psr17Factory $psr17Factory;
Expand Down
2 changes: 2 additions & 0 deletions tests/Traits/HttpRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Pickling\Test\Traits;

use Nyholm\Psr7\Factory\Psr17Factory;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Pickling\Traits\HttpRequest;
use Psr\Http\Client\ClientInterface;
Expand All @@ -14,6 +15,7 @@
use RuntimeException;
use stdClass;

#[CoversClass(HttpRequest::class)]
final class HttpRequestTest extends TestCase {
private MockClient $httpClient;
private Psr17Factory $psr17Factory;
Expand Down

0 comments on commit 08dee16

Please sign in to comment.