Skip to content

Commit

Permalink
Fix: Split
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Mar 30, 2024
1 parent 222c5d6 commit 24ab235
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 1 deletion.
52 changes: 52 additions & 0 deletions test/Fixture/broken/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

For a full diff see [`1.1.0...main`][1.1.0...main].

## [`1.1.0`][1.1.0]

For a full diff see [`1.0.0...1.1.0`][1.0.0...1.1.0].

### Added

- Added support for PHP 8.0 ([#77]), by [@localheinz]
- Added support for PHP 7.4 ([#78]), by [@localheinz]

## [`not a version`][1.0.0]

## [`1.0.0`][1.0.0]

For a full diff see [`64ced12...1.0.0`][64ced12...1.0.0].

### Added

- Added `Version` as a value object ([#1]), by [@localheinz]
- Added `Major` as a value object ([#3]), by [@localheinz]
- Added `Minor` as a value object ([#4]), by [@localheinz]
- Added `Patch` as a value object ([#5]), by [@localheinz]
- Added `PreRelease` as a value object ([#8]), by [@localheinz]
- Added `BuildMetaData` as a value object ([#9]), by [@localheinz]

## [`also not a version`]

[1.0.0]: https://github.com/ergebnis/version/releases/tag/1.0.0
[1.1.0]: https://github.com/ergebnis/version/releases/tag/1.1.0

[64ced12...1.0.0]: https://github.com/ergebnis/version/compare/64ced12...1.0.0
[1.0.0...1.1.0]: https://github.com/ergebnis/version/compare/1.0.0...1.1.0
[1.1.0...main]: https://github.com/ergebnis/version/compare/1.1.0...main

[#1]: https://github.com/ergebnis/version/pull/1
[#3]: https://github.com/ergebnis/version/pull/3
[#4]: https://github.com/ergebnis/version/pull/4
[#5]: https://github.com/ergebnis/version/pull/5
[#8]: https://github.com/ergebnis/version/pull/8
[#9]: https://github.com/ergebnis/version/pull/9
[#77]: https://github.com/ergebnis/version/pull/77

[@localheinz]: https://github.com/localheinz
48 changes: 48 additions & 0 deletions test/Fixture/ergebnis/version/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

For a full diff see [`1.1.0...main`][1.1.0...main].

## [`1.1.0`][1.1.0]

For a full diff see [`1.0.0...1.1.0`][1.0.0...1.1.0].

### Added

- Added support for PHP 8.0 ([#77]), by [@localheinz]
- Added support for PHP 7.4 ([#78]), by [@localheinz]

## [`1.0.0`][1.0.0]

For a full diff see [`64ced12...1.0.0`][64ced12...1.0.0].

### Added

- Added `Version` as a value object ([#1]), by [@localheinz]
- Added `Major` as a value object ([#3]), by [@localheinz]
- Added `Minor` as a value object ([#4]), by [@localheinz]
- Added `Patch` as a value object ([#5]), by [@localheinz]
- Added `PreRelease` as a value object ([#8]), by [@localheinz]
- Added `BuildMetaData` as a value object ([#9]), by [@localheinz]

[1.0.0]: https://github.com/ergebnis/version/releases/tag/1.0.0
[1.1.0]: https://github.com/ergebnis/version/releases/tag/1.1.0

[64ced12...1.0.0]: https://github.com/ergebnis/version/compare/64ced12...1.0.0
[1.0.0...1.1.0]: https://github.com/ergebnis/version/compare/1.0.0...1.1.0
[1.1.0...main]: https://github.com/ergebnis/version/compare/1.1.0...main

[#1]: https://github.com/ergebnis/version/pull/1
[#3]: https://github.com/ergebnis/version/pull/3
[#4]: https://github.com/ergebnis/version/pull/4
[#5]: https://github.com/ergebnis/version/pull/5
[#8]: https://github.com/ergebnis/version/pull/8
[#9]: https://github.com/ergebnis/version/pull/9
[#77]: https://github.com/ergebnis/version/pull/77

[@localheinz]: https://github.com/localheinz
18 changes: 17 additions & 1 deletion test/Unit/Markdown/VersionCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,25 @@ public function testCollectReturnsEmptyArrayWhenContentDoesNotContainAnyVersions
self::assertSame([], $collected);
}

public function testCollectReturnsArrayWithVersionsWhenContentContainsInvalidVersions(): void
{
$content = \file_get_contents(__DIR__ . '/../../Fixture/broken/CHANGELOG.md');

$versionCollector = new Markdown\VersionCollector();

$collected = $versionCollector->collect($content);

$expected = [
Version\Version::fromString('1.0.0'),
Version\Version::fromString('1.1.0'),
];

self::assertEquals($expected, $collected);
}

public function testCollectReturnsArrayWithVersionsWhenContentContainsVersions(): void
{
$content = \file_get_contents(__DIR__ . '/../../Fixture/Markdown/VersionCollector/CHANGELOG.md');
$content = \file_get_contents(__DIR__ . '/../../Fixture/ergebnis/version/CHANGELOG.md');

$versionCollector = new Markdown\VersionCollector();

Expand Down

0 comments on commit 24ab235

Please sign in to comment.