Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 7 additions & 66 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,12 @@ name: CI
on: [push, pull_request]

jobs:
phpunit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
php-version: ['8.4', '8.5']
dependencies: ['lowest', 'highest']
name: 'PHPUnit'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: xdebug
ini-values: xdebug.max_nesting_level=2048
- name: Composer
uses: "ramsey/composer-install@v2"
with:
dependency-versions: ${{ matrix.dependencies }}
- name: PHPUnit
run: vendor/bin/phpunit --coverage-clover=coverage.clover
env:
BLACKBOX_SET_SIZE: '10'
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
blackbox:
uses: innmind/github-workflows/.github/workflows/black-box-matrix.yml@main
coverage:
uses: innmind/github-workflows/.github/workflows/coverage-matrix.yml@main
secrets: inherit
psalm:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.4']
dependencies: ['lowest', 'highest']
name: 'Psalm'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Composer
uses: "ramsey/composer-install@v2"
with:
dependency-versions: ${{ matrix.dependencies }}
- name: Psalm
run: vendor/bin/psalm --shepherd
uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main
cs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.4']
name: 'CS'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Composer
uses: "ramsey/composer-install@v2"
- name: CS
run: vendor/bin/php-cs-fixer fix --diff --dry-run
uses: innmind/github-workflows/.github/workflows/cs.yml@main
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
composer.lock
vendor/
.phpunit.result.cache
.phpunit.cache
27 changes: 27 additions & 0 deletions blackbox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
declare(strict_types = 1);

require 'vendor/autoload.php';

use Innmind\BlackBox\{
Application,
PHPUnit\Load,
Runner\CodeCoverage,
};

Application::new($argv)
->when(
\getenv('ENABLE_COVERAGE') !== false,
static fn(Application $app) => $app
->codeCoverage(
CodeCoverage::of(
__DIR__.'/src/',
__DIR__.'/tests/',
)
->dumpTo('coverage.clover')
->enableWhen(true),
)
->scenariiPerProof(1),
)
->tryToProve(Load::directory(__DIR__.'/tests/'))
->exit();
6 changes: 0 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@
"Fixtures\\MusicCompanion\\AppleMusic\\": "fixtures/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\MusicCompanion\\AppleMusic\\": "tests/"
}
},
"require-dev": {
"phpunit/phpunit": "~12.0",
"innmind/black-box": "~6.5",
"innmind/static-analysis": "~1.3",
"innmind/coding-standard": "~2.0"
Expand Down
26 changes: 0 additions & 26 deletions phpunit.xml.dist

This file was deleted.

20 changes: 10 additions & 10 deletions tests/KeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
Exception\DomainException,
};
use Innmind\Filesystem\File\Content;
use PHPUnit\Framework\TestCase;
use Innmind\BlackBox\{
PHPUnit\BlackBox,
PHPUnit\Framework\TestCase,
Set,
};

class KeyTest extends TestCase
{
use BlackBox;

public function testInterface()
public function testInterface(): BlackBox\Proof
{
$this
return $this
->forAll(
Set\Elements::of(...\range('A', 'Z'), ...\range(0, 9)),
Set\Elements::of(...\range('A', 'Z'), ...\range(0, 9)),
)
->then(function($id, $teamId) {
->prove(function($id, $teamId) {
$id = \implode(\array_pad([], 10, $id));
$teamId = \implode(\array_pad([], 10, $teamId));

Expand All @@ -41,14 +41,14 @@ public function testInterface()
});
}

public function testThrowWhenInvalidId()
public function testThrowWhenInvalidId(): BlackBox\Proof
{
$this
return $this
->forAll(
Set\Strings::any(),
Set\Elements::of(...\range('A', 'Z'), ...\range(0, 9)),
)
->then(function($id, $teamId) {
->prove(function($id, $teamId) {
$teamId = \implode(\array_pad([], 10, $teamId));

$this->expectException(DomainException::class);
Expand All @@ -62,14 +62,14 @@ public function testThrowWhenInvalidId()
});
}

public function testThrowWhenInvalidTeamId()
public function testThrowWhenInvalidTeamId(): BlackBox\Proof
{
$this
return $this
->forAll(
Set\Elements::of(...\range('A', 'Z'), ...\range(0, 9)),
Set\Strings::any(),
)
->then(function($id, $teamId) {
->prove(function($id, $teamId) {
$id = \implode(\array_pad([], 10, $id));

$this->expectException(DomainException::class);
Expand Down
8 changes: 4 additions & 4 deletions tests/SDK/Catalog/Album/CopyrightTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
namespace Tests\MusicCompanion\AppleMusic\SDK\Catalog\Album;

use MusicCompanion\AppleMusic\SDK\Catalog\Album\Copyright;
use PHPUnit\Framework\TestCase;
use Innmind\BlackBox\{
PHPUnit\BlackBox,
PHPUnit\Framework\TestCase,
Set,
};

class CopyrightTest extends TestCase
{
use BlackBox;

public function testAnyStringIsAccepted()
public function testAnyStringIsAccepted(): BlackBox\Proof
{
$this
return $this
->forAll(Set\Strings::any())
->then(function(string $string) {
->prove(function(string $string) {
$copyright = Copyright::of($string);

$this->assertSame($string, $copyright->toString());
Expand Down
8 changes: 4 additions & 4 deletions tests/SDK/Catalog/Album/EditorialNotesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
namespace Tests\MusicCompanion\AppleMusic\SDK\Catalog\Album;

use MusicCompanion\AppleMusic\SDK\Catalog\Album\EditorialNotes;
use PHPUnit\Framework\TestCase;
use Innmind\BlackBox\{
PHPUnit\BlackBox,
PHPUnit\Framework\TestCase,
Set,
};

class EditorialNotesTest extends TestCase
{
use BlackBox;

public function testAnyStringIsAccepted()
public function testAnyStringIsAccepted(): BlackBox\Proof
{
$this
return $this
->forAll(Set\Strings::any(), Set\Strings::any())
->then(function(string $standard, string $short) {
->prove(function(string $standard, string $short) {
$editorialNotes = EditorialNotes::of($standard, $short);

$this->assertSame($standard, $editorialNotes->standard());
Expand Down
14 changes: 7 additions & 7 deletions tests/SDK/Catalog/Album/IdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@
SDK\Catalog\Album\Id,
Exception\DomainException,
};
use PHPUnit\Framework\TestCase;
use Innmind\BlackBox\{
PHPUnit\BlackBox,
PHPUnit\Framework\TestCase,
Set,
};

class IdTest extends TestCase
{
use BlackBox;

public function testRealNumbersAreAccepted()
public function testRealNumbersAreAccepted(): BlackBox\Proof
{
$this
return $this
->forAll(Set\NaturalNumbers::any())
->then(function(int $number) {
->prove(function(int $number) {
$id = Id::of($number);

$this->assertSame($number, $id->toInt());
$this->assertSame((string) $number, $id->toString());
});
}

public function testNegativeNumbersAreRejected()
public function testNegativeNumbersAreRejected(): BlackBox\Proof
{
$this
return $this
->forAll(Set\Integers::below(0))
->then(function(int $negative) {
->prove(function(int $negative) {
try {
Id::of($negative);
$this->fail('it should throw');
Expand Down
8 changes: 4 additions & 4 deletions tests/SDK/Catalog/Album/NameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
namespace Tests\MusicCompanion\AppleMusic\SDK\Catalog\Album;

use MusicCompanion\AppleMusic\SDK\Catalog\Album\Name;
use PHPUnit\Framework\TestCase;
use Innmind\BlackBox\{
PHPUnit\BlackBox,
PHPUnit\Framework\TestCase,
Set,
};

class NameTest extends TestCase
{
use BlackBox;

public function testAnyStringIsAccepted()
public function testAnyStringIsAccepted(): BlackBox\Proof
{
$this
return $this
->forAll(Set\Strings::any())
->then(function(string $string) {
->prove(function(string $string) {
$name = Name::of($string);

$this->assertSame($string, $name->toString());
Expand Down
8 changes: 4 additions & 4 deletions tests/SDK/Catalog/Album/RecordLabelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
namespace Tests\MusicCompanion\AppleMusic\SDK\Catalog\Album;

use MusicCompanion\AppleMusic\SDK\Catalog\Album\RecordLabel;
use PHPUnit\Framework\TestCase;
use Innmind\BlackBox\{
PHPUnit\BlackBox,
PHPUnit\Framework\TestCase,
Set,
};

class RecordLabelTest extends TestCase
{
use BlackBox;

public function testAnyStringIsAccepted()
public function testAnyStringIsAccepted(): BlackBox\Proof
{
$this
return $this
->forAll(Set\Strings::any())
->then(function(string $string) {
->prove(function(string $string) {
$recordLabel = RecordLabel::of($string);

$this->assertSame($string, $recordLabel->toString());
Expand Down
8 changes: 4 additions & 4 deletions tests/SDK/Catalog/AlbumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
Artist as ArtistSet,
};
use Innmind\Immutable\Maybe;
use PHPUnit\Framework\TestCase;
use Innmind\BlackBox\{
PHPUnit\BlackBox,
PHPUnit\Framework\TestCase,
Set as DataSet,
};
use Fixtures\Innmind\Immutable\Set as ISet;
Expand All @@ -29,9 +29,9 @@ class AlbumTest extends TestCase
{
use BlackBox;

public function testInterface()
public function testInterface(): BlackBox\Proof
{
$this
return $this
->forAll(
Id::any(),
Artwork::any(),
Expand All @@ -48,7 +48,7 @@ public function testInterface()
EditorialNotes::any(),
ISet::of(ArtistSet\Id::any()),
)
->then(function($id, $artwork, $name, $single, $url, $complete, $genres, $tracks, $masteredForItunes, $release, $recordLabel, $copyright, $editorialNotes, $artists) {
->prove(function($id, $artwork, $name, $single, $url, $complete, $genres, $tracks, $masteredForItunes, $release, $recordLabel, $copyright, $editorialNotes, $artists) {
$album = Album::of(
$id,
$artwork,
Expand Down
Loading