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
46 changes: 18 additions & 28 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,49 @@
name: run-tests

on:
- push
- pull_request
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
fail-fast: true
matrix:
php: [8.2, 8.1, 8.0]
laravel: ['8.*', '9.*', '10.*', '11.*', '12.*']
dependency-version: [prefer-stable]
php: [8.5, 8.4, 8.3, 8.2]
laravel: ['13.*', '12.*', '11.*', '10.*']
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: 6.*
- laravel: 11.*
testbench: 9.*
- laravel: 13.*
testbench: 11.*
- laravel: 12.*
testbench: 10.*
- laravel: 11.*
testbench: 9.*
- laravel: 10.*
testbench: 8.*
exclude:
- laravel: 13.*
php: 8.2
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 11.*
php: 8.0
- laravel: 12.*
php: 8.1
- laravel: 12.*
php: 8.0
php: 8.5

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }}

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
"require": {
"php": "^8.0",
"ext-json": "*",
"illuminate/contracts": "^8.71|^9.0|^10.0|^11.0|^12.0",
"illuminate/filesystem": "^8.71|^9.0|^10.0|^11.0|^12.0",
"illuminate/support": "^8.71|^9.0|^10.0|^11.0|^12.0",
"illuminate/contracts": "^8.71|^9.0|^10.0|^11.0|^12.0|^13.0",
"illuminate/filesystem": "^8.71|^9.0|^10.0|^11.0|^12.0|^13.0",
"illuminate/support": "^8.71|^9.0|^10.0|^11.0|^12.0|^13.0",
"league/commonmark": "^1.0|^2.0",
"spatie/yaml-front-matter": "^2.0",
"symfony/yaml": "^4.0|^5.0|^6.0|^7.0|^8.0"
},
"require-dev": {
"league/flysystem": "^1.0.8|^3.0",
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0|^10.0",
"phpunit/phpunit": "^9.4|^10.5|^11.5.3"
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0|^10.0|^11.0",
"phpunit/phpunit": "^9.4|^10.5|^11.5.3|^12.5.12"
},
"config": {
"sort-packages": true
Expand Down
7 changes: 1 addition & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<testsuites>
<testsuite name="Spatie Test Suite">
<directory>tests</directory>
Expand Down
3 changes: 2 additions & 1 deletion tests/ContentParsers/JsonParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Spatie\Sheets\ContentParsers\JsonParser;
use Spatie\Sheets\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class JsonParserTest extends TestCase
{
/** @test */
#[Test]
public function it_converts_a_front_matter_document_to_attributes()
{
$jsonParser = $this->app->make(JsonParser::class);
Expand Down
3 changes: 2 additions & 1 deletion tests/ContentParsers/MarkdownParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Spatie\Sheets\ContentParsers\MarkdownParser;
use Spatie\Sheets\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class MarkdownParserTest extends TestCase
{
/** @test */
#[Test]
public function it_converts_a_front_matter_document_to_attributes()
{
$markdownParser = $this->app->make(MarkdownParser::class);
Expand Down
3 changes: 2 additions & 1 deletion tests/ContentParsers/MarkdownWithFrontMatterParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Spatie\Sheets\ContentParsers\MarkdownWithFrontMatterParser;
use Spatie\Sheets\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class MarkdownWithFrontMatterParserTest extends TestCase
{
/** @test */
#[Test]
public function it_converts_a_front_matter_document_to_attributes()
{
$markdownWithFrontMatterParser = $this->app->make(MarkdownWithFrontMatterParser::class);
Expand Down
3 changes: 2 additions & 1 deletion tests/ContentParsers/YamlParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Spatie\Sheets\ContentParsers\YamlParser;
use Spatie\Sheets\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class YamlParserTest extends TestCase
{
/** @test */
#[Test]
public function it_converts_a_front_matter_document_to_attributes()
{
$yamlParser = $this->app->make(YamlParser::class);
Expand Down
3 changes: 2 additions & 1 deletion tests/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use Spatie\Sheets\ContentParsers\MarkdownWithFrontMatterParser;
use Spatie\Sheets\Factory;
use Spatie\Sheets\PathParsers\SlugParser;
use PHPUnit\Framework\Attributes\Test;

class FactoryTest extends TestCase
{
/** @test */
#[Test]
public function it_extracts_a_slug_attribute_from_a_path()
{
$factory = new Factory(
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/CustomContentParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use Spatie\Sheets\ContentParsers\MarkdownParser;
use Spatie\Sheets\Sheet;
use Spatie\Sheets\Sheets;
use PHPUnit\Framework\Attributes\Test;

class CustomContentParserTest extends TestCase
{
/** @test */
#[Test]
public function it_can_maintain_a_collection_with_a_custom_content_parser()
{
$documents = $this->app->make(Sheets::class)->all();
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/CustomDiskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
use Illuminate\Support\Collection;
use Spatie\Sheets\Sheet;
use Spatie\Sheets\Sheets;
use PHPUnit\Framework\Attributes\Test;

class CustomDiskTest extends TestCase
{
/** @test */
#[Test]
public function it_can_maintain_a_collection_on_a_specific_disk()
{
$content = $this->app->make(Sheets::class)->all();
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/CustomPathParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
use Spatie\Sheets\PathParsers\SlugWithDateParser;
use Spatie\Sheets\Sheet;
use Spatie\Sheets\Sheets;
use PHPUnit\Framework\Attributes\Test;

class CustomPathParserTest extends TestCase
{
/** @test */
#[Test]
public function it_can_maintain_a_collection_with_a_custom_path_parser()
{
$posts = $this->app->make(Sheets::class)->all();
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/CustomRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use Spatie\Sheets\Repository;
use Spatie\Sheets\Sheet;
use Spatie\Sheets\Sheets;
use PHPUnit\Framework\Attributes\Test;

class CustomRepositoryTest extends TestCase
{
/** @test */
#[Test]
public function it_can_maintain_a_collection_with_a_custom_repository()
{
$documents = $this->app->make(Sheets::class)->all();
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/CustomSheetClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
use Spatie\Sheets\PathParsers\SlugWithDateParser;
use Spatie\Sheets\Sheets;
use Spatie\Sheets\Tests\Integration\DummySheets\Post;
use PHPUnit\Framework\Attributes\Test;

class CustomSheetClassTest extends TestCase
{
/** @test */
#[Test]
public function it_can_maintain_a_collection_with_a_custom_sheet_class()
{
$posts = $this->app->make(Sheets::class)->all();
Expand Down
7 changes: 4 additions & 3 deletions tests/Integration/DefaultConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
use Illuminate\Support\Collection;
use Spatie\Sheets\Sheet;
use Spatie\Sheets\Sheets;
use PHPUnit\Framework\Attributes\Test;

class DefaultConfigTest extends TestCase
{
/** @test */
#[Test]
public function it_can_maintain_a_default_collection()
{
$content = $this->app->make(Sheets::class)->all();
Expand All @@ -18,7 +19,7 @@ public function it_can_maintain_a_default_collection()
$this->assertContainsOnlyInstancesOf(Sheet::class, $content);
}

/** @test */
#[Test]
public function it_can_retrieve_a_default_collection_via_helper()
{
$content = sheets()->all();
Expand All @@ -28,7 +29,7 @@ public function it_can_retrieve_a_default_collection_via_helper()
$this->assertContainsOnlyInstancesOf(Sheet::class, $content);
}

/** @test */
#[Test]
public function it_can_retrieve_an_explicit_collection_via_helper()
{
$content = sheets('content')->all();
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/ExplicitDefaultCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use Spatie\Sheets\Sheets;
use Spatie\Sheets\Tests\Integration\DummySheets\Page;
use Spatie\Sheets\Tests\Integration\DummySheets\Post;
use PHPUnit\Framework\Attributes\Test;

class ExplicitDefaultCollectionTest extends TestCase
{
/** @test */
#[Test]
public function it_accepts_an_explicit_default_collection()
{
$posts = $this->app->make(Sheets::class)->all();
Expand Down
9 changes: 5 additions & 4 deletions tests/Integration/ImplicitDefaultCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use Spatie\Sheets\Sheets;
use Spatie\Sheets\Tests\Integration\DummySheets\Page;
use Spatie\Sheets\Tests\Integration\DummySheets\Post;
use PHPUnit\Framework\Attributes\Test;

class ImplicitDefaultCollectionTest extends TestCase
{
/** @test */
#[Test]
public function it_defaults_to_the_first_collection_if_no_default_is_provided()
{
$content = $this->app->make(Sheets::class)->all();
Expand All @@ -18,7 +19,7 @@ public function it_defaults_to_the_first_collection_if_no_default_is_provided()
$this->assertContainsOnlyInstancesOf(Page::class, $content);
}

/** @test */
#[Test]
public function it_throws_exception_on_non_existed_collections()
{
$this->expectException(\RuntimeException::class);
Expand All @@ -27,13 +28,13 @@ public function it_throws_exception_on_non_existed_collections()
$content = $this->app->make(Sheets::class)->collection('invalid_collection');
}

/** @test */
#[Test]
public function it_can_get_null_on_the_default_collection()
{
$this->assertNull($this->app->make(Sheets::class)->get('non_existed_collections'));
}

/** @test */
#[Test]
public function it_throws_exception_on_set_default_collection()
{
$this->expectException(\RuntimeException::class);
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/MultipleCollectionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
use Spatie\Sheets\Sheets;
use Spatie\Sheets\Tests\Integration\DummySheets\Page;
use Spatie\Sheets\Tests\Integration\DummySheets\Post;
use PHPUnit\Framework\Attributes\Test;

class MultipleCollectionsTest extends TestCase
{
/** @test */
#[Test]
public function it_can_maintain_multiple_collections()
{
$content = $this->app->make(Sheets::class)->collection('content')->all();
Expand Down
5 changes: 3 additions & 2 deletions tests/PathParsers/SlugParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@

use Spatie\Sheets\PathParsers\SlugParser;
use Spatie\Sheets\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class SlugParserTest extends TestCase
{
/** @test */
#[Test]
public function it_extracts_a_slug_attribute_from_a_path()
{
$slugParser = new SlugParser();

$this->assertEquals(['slug' => 'hello-world'], $slugParser->parse('hello-world.md'));
}

/** @test */
#[Test]
public function it_extracts_a_slug_attribute_from_a_nested_path()
{
$slugParser = new SlugParser();
Expand Down
5 changes: 3 additions & 2 deletions tests/PathParsers/SlugWithDateParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
use Illuminate\Support\Carbon;
use Spatie\Sheets\PathParsers\SlugWithDateParser;
use Spatie\Sheets\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class SlugWithDateParserTest extends TestCase
{
/** @test */
#[Test]
public function it_extracts_a_date_and_slug_attribute_from_a_path()
{
$slugWithDateParser = new SlugWithDateParser();
Expand All @@ -21,7 +22,7 @@ public function it_extracts_a_date_and_slug_attribute_from_a_path()
$this->assertEquals($expected, $slugWithDateParser->parse('1992-02-01.hello-world.md'));
}

/** @test */
#[Test]
public function it_extracts_a_date_and_slug_attribute_from_a_nested_path()
{
$slugWithDateParser = new SlugWithDateParser();
Expand Down
Loading