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: 4 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.php]
[*.{ym,yml,yaml,js,json,scss}]
indent_style = space
indent_size = 4
indent_size = 2

[*.{ym,yaml,js,json,scss}]
[*.{php,md}]
indent_style = space
indent_size = 2
indent_size = 4
46 changes: 23 additions & 23 deletions .github/workflows/php84.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
name: PHP 8.4

on:
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.2.2
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.2.2

- name: Setup PHP Action
uses: shivammathur/setup-php@2.33.0
with:
php-version: '8.4'
- name: Setup PHP Action
uses: shivammathur/setup-php@2.33.0
with:
php-version: '8.4'

- name: Validate composer.json and composer.lock
run: composer validate
- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run style check
run: composer run style
- name: Run style check
run: composer run style

- name: Run static analyzer
run: composer run stan
- name: Run static analyzer
run: composer run stan

- name: Run tests
run: composer run test
- name: Run tests
run: composer run test
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"production": ["@style", "@stan", "@test"],
"style": "./vendor/bin/phpcs --standard=phpcs.xml -p ./src",
"stan": "./vendor/bin/phpstan analyze",
"test": "./vendor/bin/phpunit"
"test": "./vendor/bin/phpunit --display-all-issues"
}
}
37 changes: 18 additions & 19 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,26 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
bootstrap="vendor/autoload.php"
cacheResult="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" backupStaticProperties="false">
<coverage/>
<testsuites>
<testsuite name="base">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
</php>
<source>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory>vendor/</directory>
</exclude>
</source>
<coverage/>
<testsuites>
<testsuite name="base">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<ini name="display_errors" value="On"/>
<ini name="display_startup_errors" value="On"/>
</php>
<source>
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<directory>vendor/</directory>
</exclude>
</source>
</phpunit>
21 changes: 6 additions & 15 deletions tests/Components/CopyrightTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

namespace Eightfold\HTMLBuilder\Tests\Components;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

use Eightfold\HTMLBuilder\Components\Copyright;

class CopyrightTest extends TestCase
{
/**
* @test
*/
#[Test]
public function can_use_default(): void
{
$expected = '<p>© ' . date('Y') . ' Dr. Copyright</p>';
Expand All @@ -24,9 +23,7 @@ public function can_use_default(): void
);
}

/**
* @test
*/
#[Test]
public function can_use_bare_string(): void
{
$expected = '© ' . date('Y') . ' Dr. Copyright';
Expand All @@ -51,9 +48,7 @@ public function can_use_bare_string(): void
);
}

/**
* @test
*/
#[Test]
public function can_have_year_range(): void
{
$expected = '<p>© 2020–' . date('Y') . ' Dr. Copyright</p>';
Expand All @@ -66,9 +61,7 @@ public function can_have_year_range(): void
);
}

/**
* @test
*/
#[Test]
public function can_include_copyright(): void
{
$expected = '<p>Copyright ' . date('Y') . ' Dr. Copyright</p>';
Expand All @@ -92,9 +85,7 @@ public function can_include_copyright(): void
);
}

/**
* @test
*/
#[Test]
public function can_modify_reservations(): void
{
$expected = '<p>© ' . date('Y') . ' Dr. Copyright. All rights reserved.</p>';
Expand Down
21 changes: 6 additions & 15 deletions tests/Components/FaviconsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Eightfold\HTMLBuilder\Tests\Components;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

use Eightfold\HTMLBuilder\Components\Favicons;
Expand All @@ -11,9 +12,7 @@

class FaviconsTest extends TestCase
{
/**
* @test
*/
#[Test]
public function can_use_default(): void
{
$expected = file_get_contents(__DIR__ . '/favicons-default.xml');
Expand All @@ -26,9 +25,7 @@ public function can_use_default(): void
);
}

/**
* @test
*/
#[Test]
public function can_set_theme_color(): void
{
$expected = file_get_contents(__DIR__ . '/favicons-theme-color.xml');
Expand All @@ -43,9 +40,7 @@ public function can_set_theme_color(): void
);
}

/**
* @test
*/
#[Test]
public function can_use_subfolder(): void
{
$expected = file_get_contents(__DIR__ . '/favicons-subfolder.xml');
Expand All @@ -58,9 +53,7 @@ public function can_use_subfolder(): void
);
}

/**
* @test
*/
#[Test]
public function can_use_custom_app_name(): void
{
$expected = file_get_contents(__DIR__ . '/favicons-app-name.xml');
Expand All @@ -73,9 +66,7 @@ public function can_use_custom_app_name(): void
);
}

/**
* @test
*/
#[Test]
public function can_use_windows_metro_settings(): void
{
$expected = file_get_contents(__DIR__ . '/favicons-windows-metro.xml');
Expand Down
29 changes: 8 additions & 21 deletions tests/DocumentBaselineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Eightfold\HTMLBuilder\Tests;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

use Eightfold\HTMLBuilder\Document;
Expand All @@ -13,9 +14,7 @@

class DocumentBaselineTest extends TestCase
{
/**
* @test
*/
#[Test]
public function can_add_properties_to_body_element(): void // phpcs:ignore
{
$expected = <<<html
Expand All @@ -33,9 +32,7 @@ public function can_add_properties_to_body_element(): void // phpcs:ignore
);
}

/**
* @test
*/
#[Test]
public function can_use_page_title(): void // phpcs:ignore
{
$expected = <<<html
Expand All @@ -53,9 +50,7 @@ public function can_use_page_title(): void // phpcs:ignore
);
}

/**
* @test
*/
#[Test]
public function is_stringable(): void // phpcs:ignore
{
$expected = <<<html
Expand All @@ -74,9 +69,7 @@ public function is_stringable(): void // phpcs:ignore
$this->assertSame($expected, $result);
}

/**
* @test
*/
#[Test]
public function can_have_body(): void // phpcs:ignore
{
$expected = <<<html
Expand All @@ -95,9 +88,7 @@ public function can_have_body(): void // phpcs:ignore
$this->assertSame($expected, $result);
}

/**
* @test
*/
#[Test]
public function can_have_head(): void // phpcs:ignore
{
$expected = <<<html
Expand All @@ -114,9 +105,7 @@ public function can_have_head(): void // phpcs:ignore
$this->assertSame($expected, $result);
}

/**
* @test
*/
#[Test]
public function can_change_lang_and_char_set(): void // phpcs:ignore
{
$expected = <<<html
Expand All @@ -129,9 +118,7 @@ public function can_change_lang_and_char_set(): void // phpcs:ignore
$this->assertSame($expected, $result);
}

/**
* @test
*/
#[Test]
public function has_baseline(): void // phpcs:ignore
{
$expected = <<<html
Expand Down
13 changes: 4 additions & 9 deletions tests/ElementBaselineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

namespace Eightfold\HTMLBuilder\Tests;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

use Eightfold\HTMLBuilder\Element;

class ElementBaselineTest extends TestCase
{
/**
* @test
*/
#[Test]
public function can_have_empty_props(): void // phpcs:ignore
{
$expected = <<<html
Expand All @@ -23,9 +22,7 @@ public function can_have_empty_props(): void // phpcs:ignore
$this->assertSame($expected, $result);
}

/**
* @test
*/
#[Test]
public function has_ordered_properties(): void // phpcs:ignore
{
$expected = <<<html
Expand All @@ -43,9 +40,7 @@ public function has_ordered_properties(): void // phpcs:ignore
$this->assertSame($expected, $result);
}

/**
* @test
*/
#[Test]
public function has_correct_selfclosing_string(): void // phpcs:ignore
{
$expected = <<<html
Expand Down
5 changes: 2 additions & 3 deletions tests/ElementExtensionBaselineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

namespace Eightfold\HTMLBuilder\Tests;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

use Eightfold\HTMLBuilder\Tests\Extensions\ElementExtension;

class ElementExtensionBaselineTest extends TestCase
{
/**
* @test
*/
#[Test]
public function has_ordered_properties(): void // phpcs:ignore
{
$exptected = <<<html
Expand Down
Loading
Loading