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
8 changes: 5 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ jobs:
fail-fast: true
matrix:
php: [ 8.1, 8.2, 8.3, 8.4 ]
illuminate: [ ^10.0, ^11.0 ]
illuminate: [ ^10.0, ^11.0, ^12.0 ]
stability: [ prefer-lowest, prefer-stable ]
include:
- illuminate: ^10.0
testbench: 8.*
- illuminate: ^11.0
testbench: 9.*
- illuminate: ^12.0
testbench: 10.*
exclude:
- php: 8.1
illuminate: ^11.0
- php: 8.4
illuminate: ^10.0
- php: 8.1
illuminate: ^12.0

name: P${{ matrix.php }} - I${{ matrix.illuminate }} - ${{ matrix.stability }}

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased](https://github.com/markwalet/laravel-changelog/compare/v1.10.0...master)

### Added
- Support Laravel 12
- Included PHP 8.4 in test matrix

## [v1.10.0 (2024-03-13)](https://github.com/markwalet/laravel-changelog/compare/v1.9.0...v1.10.0)
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
],
"require": {
"php": "8.*",
"laravel/framework": "^10.0|^11.0",
"laravel/framework": "^10.0|^11.0|^12.0",
"markwalet/laravel-git-state": "~1.0",
"ext-simplexml": "*",
"ext-dom": "*"
},
"require-dev": {
"phpunit/phpunit": "^10.5",
"phpunit/phpunit": "^10.5|^11.0",
"mockery/mockery": "~1.4",
"orchestra/testbench": "8.*|9.*"
"orchestra/testbench": "8.*|9.*|10.*"
},
"autoload": {
"psr-4": {
Expand All @@ -34,6 +34,8 @@
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"laravel": {
"providers": [
Expand Down
5 changes: 3 additions & 2 deletions tests/Adapters/FakeFeatureAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use MarkWalet\Changelog\Change;
use MarkWalet\Changelog\Feature;
use MarkWalet\Changelog\Tests\LaravelTestCase;
use PHPUnit\Framework\Attributes\Test;

class FakeFeatureAdapterTest extends LaravelTestCase
{
Expand All @@ -31,8 +32,8 @@ public function adapter(): FeatureAdapter
return $adapter;
}

/** @test */
public function it_can_write_a_changelog()
#[Test]
public function it_can_write_a_changelog(): void
{
$adapter = $this->adapter();
$feature = new Feature([
Expand Down
5 changes: 4 additions & 1 deletion tests/Adapters/FakeReleaseAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use MarkWalet\Changelog\Feature;
use MarkWalet\Changelog\Release;
use MarkWalet\Changelog\Tests\LaravelTestCase;
use PHPUnit\Framework\Attributes\Test;

class FakeReleaseAdapterTest extends LaravelTestCase
{
Expand Down Expand Up @@ -58,8 +59,10 @@ public function adapter(): ReleaseAdapter
return $adapter;
}

public function it_can_execute_a_release()
#[Test]
public function it_can_execute_a_release(): void
{
$this->markTestSkipped();
$adapter = $this->adapter();
$path = __DIR__.'/../test-data/release-write-test';

Expand Down
13 changes: 7 additions & 6 deletions tests/Adapters/FeatureAdapterTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use MarkWalet\Changelog\Adapters\FeatureAdapter;
use MarkWalet\Changelog\Exceptions\FileNotFoundException;
use PHPUnit\Framework\Attributes\Test;

trait FeatureAdapterTests
{
Expand All @@ -16,8 +17,8 @@ trait FeatureAdapterTests
*/
abstract public function adapter(): FeatureAdapter;

/** @test */
public function it_can_see_if_a_changelog_exists()
#[Test]
public function it_can_see_if_a_changelog_exists(): void
{
$adapter = $this->adapter();

Expand All @@ -28,8 +29,8 @@ public function it_can_see_if_a_changelog_exists()
$this->assertFalse($resultB);
}

/** @test */
public function it_can_read_a_changelog()
#[Test]
public function it_can_read_a_changelog(): void
{
$adapter = $this->adapter();

Expand All @@ -47,8 +48,8 @@ public function it_can_read_a_changelog()
$this->assertEquals('Removed a deprecated function.', $changes[3]->message());
}

/** @test */
public function it_throws_an_exception_when_it_tries_to_read_a_non_existing_file()
#[Test]
public function it_throws_an_exception_when_it_tries_to_read_a_non_existing_file(): void
{
$adapter = $this->adapter();
$path = __DIR__.'/../test-data/not-existing.xml';
Expand Down
29 changes: 15 additions & 14 deletions tests/Adapters/ReleaseAdapterTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use MarkWalet\Changelog\Exceptions\DirectoryNotFoundException;
use MarkWalet\Changelog\Exceptions\FileNotFoundException;
use MarkWalet\Changelog\Exceptions\VersionAlreadyExistsException;
use PHPUnit\Framework\Attributes\Test;

trait ReleaseAdapterTests
{
Expand All @@ -21,8 +22,8 @@ trait ReleaseAdapterTests
*/
abstract public function adapter(): ReleaseAdapter;

/** @test */
public function it_can_see_if_a_release_exists()
#[Test]
public function it_can_see_if_a_release_exists(): void
{
$adapter = $this->adapter();

Expand All @@ -33,8 +34,8 @@ public function it_can_see_if_a_release_exists()
$this->assertFalse($resultB);
}

/** @test */
public function it_can_read_a_release()
#[Test]
public function it_can_read_a_release(): void
{
$adapter = $this->adapter();

Expand All @@ -53,8 +54,8 @@ public function it_can_read_a_release()
$this->assertEquals('Removed unused trait.', $changes[3]->message());
}

/** @test */
public function it_can_read_changes_of_a_nested_release()
#[Test]
public function it_can_read_changes_of_a_nested_release(): void
{
$adapter = $this->adapter();

Expand All @@ -71,8 +72,8 @@ public function it_can_read_changes_of_a_nested_release()
$this->assertEquals('Removed unused trait.', $changes[2]->message());
}

/** @test */
public function it_can_list_all_releases()
#[Test]
public function it_can_list_all_releases(): void
{
$adapter = $this->adapter();

Expand All @@ -87,26 +88,26 @@ public function it_can_list_all_releases()
$this->assertCount(2, $releases[2]->changes());
}

/** @test */
public function it_throws_an_exception_when_the_release_is_not_found()
#[Test]
public function it_throws_an_exception_when_the_release_is_not_found(): void
{
$this->expectException(FileNotFoundException::class);
$adapter = $this->adapter();

$adapter->read('non-existing', 'version');
}

/** @test */
public function it_throws_an_exception_when_the_working_directory_is_not_found()
#[Test]
public function it_throws_an_exception_when_the_working_directory_is_not_found(): void
{
$this->expectException(DirectoryNotFoundException::class);
$adapter = $this->adapter();

$adapter->all('non-existing');
}

/** @test */
public function it_throws_an_exception_when_the_version_already_exists()
#[Test]
public function it_throws_an_exception_when_the_version_already_exists(): void
{
$this->expectException(VersionAlreadyExistsException::class);
$adapter = $this->adapter();
Expand Down
13 changes: 7 additions & 6 deletions tests/Adapters/XmlFeatureAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use MarkWalet\Changelog\Exceptions\InvalidXmlException;
use MarkWalet\Changelog\Feature;
use MarkWalet\Changelog\Tests\LaravelTestCase;
use PHPUnit\Framework\Attributes\Test;

class XmlFeatureAdapterTest extends LaravelTestCase
{
Expand All @@ -23,8 +24,8 @@ public function adapter(): FeatureAdapter
return new XmlFeatureAdapter;
}

/** @test */
public function it_can_write_a_changelog()
#[Test]
public function it_can_write_a_changelog(): void
{
$adapter = $this->adapter();
$feature = new Feature([
Expand All @@ -43,8 +44,8 @@ public function it_can_write_a_changelog()
unlink($path);
}

/** @test */
public function it_creates_the_directory_recursively_if_it_does_not_exist()
#[Test]
public function it_creates_the_directory_recursively_if_it_does_not_exist(): void
{
$adapter = $this->adapter();
$feature = new Feature([
Expand All @@ -65,8 +66,8 @@ public function it_creates_the_directory_recursively_if_it_does_not_exist()
rmdir($folderA);
}

/** @test */
public function it_throws_an_exception_when_the_file_is_invalid()
#[Test]
public function it_throws_an_exception_when_the_file_is_invalid(): void
{
$adapter = $this->adapter();
$path = __DIR__.'/../test-data/invalid.xml';
Expand Down
5 changes: 3 additions & 2 deletions tests/Adapters/XmlReleaseAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use MarkWalet\Changelog\Adapters\XmlReleaseAdapter;
use MarkWalet\Changelog\Tests\LaravelTestCase;
use PHPUnit\Framework\Attributes\Test;

class XmlReleaseAdapterTest extends LaravelTestCase
{
Expand All @@ -19,8 +20,8 @@ public function adapter(): XmlReleaseAdapter
return new XmlReleaseAdapter();
}

/** @test */
public function it_can_execute_a_release()
#[Test]
public function it_can_execute_a_release(): void
{
$adapter = $this->adapter();
$path = __DIR__.'/../test-data/release-write-test';
Expand Down
9 changes: 5 additions & 4 deletions tests/ChangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
namespace MarkWalet\Changelog\Tests;

use MarkWalet\Changelog\Change;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

class ChangeTest extends TestCase
{
/** @test */
public function it_can_set_properties_trough_the_constructor()
#[Test]
public function it_can_set_properties_trough_the_constructor(): void
{
$change = new Change('added', 'Added a new feature');

Expand All @@ -19,8 +20,8 @@ public function it_can_set_properties_trough_the_constructor()
$this->assertEquals('Added a new feature', $message);
}

/** @test */
public function change_type_is_converted_to_lowercase()
#[Test]
public function change_type_is_converted_to_lowercase(): void
{
$changeA = new Change('Ucfirst', '');
$changeB = new Change('UPPERCASE', '');
Expand Down
21 changes: 11 additions & 10 deletions tests/ChangelogFormatterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
use MarkWalet\Changelog\Exceptions\MissingConfigurationException;
use MarkWalet\Changelog\Formatters\ChangelogFormatter;
use MarkWalet\Changelog\Release;
use PHPUnit\Framework\Attributes\Test;

class ChangelogFormatterFactoryTest extends LaravelTestCase
{
/** @test */
public function it_can_generate_a_factory()
#[Test]
public function it_can_generate_a_factory(): void
{
$this->app['config']['changelog.formatters.test-driver'] = [
'driver' => TestFormatter::class,
Expand All @@ -24,8 +25,8 @@ public function it_can_generate_a_factory()
$this->assertInstanceOf(TestFormatter::class, $formatter);
}

/** @test */
public function it_passes_through_configuration_options_to_the_formatter()
#[Test]
public function it_passes_through_configuration_options_to_the_formatter(): void
{
$this->app['config']['changelog.formatters.test-driver'] = [
'driver' => TestFormatter::class,
Expand All @@ -43,8 +44,8 @@ public function it_passes_through_configuration_options_to_the_formatter()
], $config);
}

/** @test */
public function it_throws_an_exception_if_the_format_configuration_does_not_exist()
#[Test]
public function it_throws_an_exception_if_the_format_configuration_does_not_exist(): void
{
/** @var ChangelogFormatterFactory $factory */
$factory = $this->app->make(ChangelogFormatterFactory::class);
Expand All @@ -53,8 +54,8 @@ public function it_throws_an_exception_if_the_format_configuration_does_not_exis
$factory->make('non-existing');
}

/** @test */
public function it_throws_an_exception_when_the_driver_is_not_set_in_a_configuration()
#[Test]
public function it_throws_an_exception_when_the_driver_is_not_set_in_a_configuration(): void
{
$this->app['config']['changelog.formatters.missing-driver'] = [
'other-option' => 'value',
Expand All @@ -66,8 +67,8 @@ public function it_throws_an_exception_when_the_driver_is_not_set_in_a_configura
$factory->make('missing-driver');
}

/** @test */
public function it_throws_an_exception_when_the_driver_does_not_extends_the_base_formatter_class()
#[Test]
public function it_throws_an_exception_when_the_driver_does_not_extends_the_base_formatter_class(): void
{
$this->app['config']['changelog.formatters.invalid-driver'] = [
'driver' => InvalidFormatter::class,
Expand Down
Loading