From d2a136b3ed5e8261147e89727099c609eadb5dfb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 May 2026 00:48:32 +0000 Subject: [PATCH 1/4] chore: migrate travis ci to github actions Agent-Logs-Url: https://github.com/voku/CssToInlineStyles/sessions/a3f41a43-df1a-42d1-a770-7ae66639c050 Co-authored-by: voku <264695+voku@users.noreply.github.com> --- .github/workflows/ci.yml | 66 +++++++++++++++++++++++++++++++++ .travis.yml | 29 --------------- README.md | 5 +-- composer.json | 3 +- phpunit.xml | 24 ++++++------ tests/CssToInlineStylesTest.php | 20 +++++----- 6 files changed, 93 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ecdcb8b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,66 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: none + tools: composer:v2 + + - run: composer update --no-interaction --prefer-dist --no-progress + + - run: vendor/bin/phpunit -c phpunit.xml + + static-analysis: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + coverage: none + tools: composer:v2 + + - run: composer update --no-interaction --prefer-dist --no-progress + + - run: vendor/bin/phpstan analyse + + coverage: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + coverage: xdebug + tools: composer:v2 + + - run: composer update --no-interaction --prefer-dist --no-progress + + - run: mkdir -p build/logs + + - run: vendor/bin/phpunit -c phpunit.xml --coverage-clover build/logs/clover.xml + + - uses: codecov/codecov-action@v5 + with: + files: build/logs/clover.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 10ebe43..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ - -language: php - -sudo: false - -php: - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -before_script: - - wget https://scrutinizer-ci.com/ocular.phar - - travis_retry composer self-update - - travis_retry composer require satooshi/php-coveralls - - if [ "$(phpenv version-name)" == 7.3 ]; then travis_retry composer require phpstan/phpstan; fi - - travis_retry composer install --no-interaction --prefer-source - - composer dump-autoload -o - -script: - - mkdir -p build/logs - - php vendor/bin/phpunit -c phpunit.xml - - if [ "$(phpenv version-name)" == 7.3 ]; then php vendor/bin/phpstan analyse; fi - -after_script: - - php vendor/bin/coveralls -v - - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - - bash <(curl -s https://codecov.io/bash) diff --git a/README.md b/README.md index 7dc987d..982c16c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/voku/CssToInlineStyles.svg?branch=master)](https://travis-ci.org/voku/CssToInlineStyles) +[![CI](https://github.com/voku/CssToInlineStyles/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/voku/CssToInlineStyles/actions/workflows/ci.yml) [![codecov.io](http://codecov.io/github/voku/CssToInlineStyles/coverage.svg?branch=master)](http://codecov.io/github/voku/CssToInlineStyles?branch=master) [![Coverage Status](https://coveralls.io/repos/voku/CssToInlineStyles/badge.svg)](https://coveralls.io/r/voku/CssToInlineStyles) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/voku/CssToInlineStyles/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/voku/CssToInlineStyles/?branch=master) @@ -7,7 +7,7 @@ [![Latest Stable Version](https://poser.pugx.org/voku/css-to-inline-styles/v/stable)](https://packagist.org/packages/voku/css-to-inline-styles) [![Total Downloads](https://poser.pugx.org/voku/css-to-inline-styles/downloads)](https://packagist.org/packages/voku/css-to-inline-styles) [![Latest Unstable Version](https://poser.pugx.org/voku/css-to-inline-styles/v/unstable)](https://packagist.org/packages/voku/css-to-inline-styles) -[![PHP 7 ready](http://php7ready.timesplinter.ch/voku/CssToInlineStyles/badge.svg)](https://travis-ci.org/voku/CssToInlineStyles) +[![CI](https://github.com/voku/CssToInlineStyles/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/voku/CssToInlineStyles/actions/workflows/ci.yml) [![License](https://poser.pugx.org/voku/css-to-inline-styles/license)](https://packagist.org/packages/voku/css-to-inline-styles) # CssToInlineStyles class @@ -74,4 +74,3 @@ $cssToInlineStyles->setCleanup(true); ## Known issues * no support for pseudo selectors - diff --git a/composer.json b/composer.json index 21ff614..e3ba806 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ "ext-dom": "*" }, "require-dev": { - "phpunit/phpunit": "~6.0 || ~7.0" + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "^9.6" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index d7d3dbb..0e38016 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,13 +1,15 @@ - - - tests - - - + + + + tests + + + + ./src/ - - - - - + + diff --git a/tests/CssToInlineStylesTest.php b/tests/CssToInlineStylesTest.php index cc9bddb..4c19504 100644 --- a/tests/CssToInlineStylesTest.php +++ b/tests/CssToInlineStylesTest.php @@ -18,12 +18,12 @@ final class CssToInlineStylesTest extends \PHPUnit\Framework\TestCase */ protected $cssToInlineStyles; - protected function setUp() + protected function setUp(): void { $this->cssToInlineStyles = new CssToInlineStyles(); } - protected function teardown() + protected function tearDown(): void { $this->cssToInlineStyles = null; } @@ -521,7 +521,7 @@ public function testXHTMLOutput() $this->cssToInlineStyles->setCSS($css); $actual = $this->cssToInlineStyles->convert(true); - static::assertContains('', $actual); + static::assertStringContainsString('', $actual); } public function testCleanup() @@ -602,14 +602,14 @@ public function testEncodingIso() $this->cssToInlineStyles->setEncoding('ISO-8859-1'); $result = $this->runHTMLToCSS($html, $css, $expected); - static::assertContains('

H', $result); - static::assertContains('Iñtërnâtiônàlizætiøn', $result); + static::assertStringContainsString('

H', $result); + static::assertStringContainsString('Iñtërnâtiônàlizætiøn', $result); } public function testEncodingUtf8() { $testString = \file_get_contents(__DIR__ . '/fixtures/test1Utf8.txt'); - static::assertContains('Iñtërnâtiônàlizætiøn', $testString); + static::assertStringContainsString('Iñtërnâtiônàlizætiøn', $testString); $html = '

' . $testString . '

'; $css = ''; @@ -618,13 +618,13 @@ public function testEncodingUtf8() $this->cssToInlineStyles->setEncoding('UTF-8'); $result = $this->runHTMLToCSS($html, $css, $expected); - static::assertContains('

Hírek', $result); - static::assertContains('Iñtërnâtiônàlizætiøn', $result); + static::assertStringContainsString('

Hírek', $result); + static::assertStringContainsString('Iñtërnâtiônàlizætiøn', $result); } public function testNoHtml() { - $this->expectException('Exception'); + $this->expectException(\Exception::class); $this->expectExceptionMessage('No HTML provided.'); $this->cssToInlineStyles->setHTML(''); @@ -640,7 +640,7 @@ public function testXMLHeaderIsRemoved() $this->cssToInlineStyles->setHTML($html); $this->cssToInlineStyles->setCSS(''); - static::assertNotContains('cssToInlineStyles->convert(true)); + static::assertStringNotContainsString('cssToInlineStyles->convert(true)); } public function testXMLHeaderIsRemovedv2() From 2cb2803ed45af366d710117c0df9041f4838bee3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 May 2026 00:48:47 +0000 Subject: [PATCH 2/4] fix: trigger github actions on branch pushes Agent-Logs-Url: https://github.com/voku/CssToInlineStyles/sessions/a3f41a43-df1a-42d1-a770-7ae66639c050 Co-authored-by: voku <264695+voku@users.noreply.github.com> --- .github/workflows/ci.yml | 2 -- README.md | 1 - 2 files changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecdcb8b..53b4565 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,6 @@ name: CI on: push: - branches: - - master pull_request: jobs: diff --git a/README.md b/README.md index 982c16c..2aa58ba 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ [![Latest Stable Version](https://poser.pugx.org/voku/css-to-inline-styles/v/stable)](https://packagist.org/packages/voku/css-to-inline-styles) [![Total Downloads](https://poser.pugx.org/voku/css-to-inline-styles/downloads)](https://packagist.org/packages/voku/css-to-inline-styles) [![Latest Unstable Version](https://poser.pugx.org/voku/css-to-inline-styles/v/unstable)](https://packagist.org/packages/voku/css-to-inline-styles) -[![CI](https://github.com/voku/CssToInlineStyles/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/voku/CssToInlineStyles/actions/workflows/ci.yml) [![License](https://poser.pugx.org/voku/css-to-inline-styles/license)](https://packagist.org/packages/voku/css-to-inline-styles) # CssToInlineStyles class From 9670acc4d925f49bd88e33a41c4c1954835d778c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 May 2026 00:49:49 +0000 Subject: [PATCH 3/4] fix: scope github actions token permissions Agent-Logs-Url: https://github.com/voku/CssToInlineStyles/sessions/a3f41a43-df1a-42d1-a770-7ae66639c050 Co-authored-by: voku <264695+voku@users.noreply.github.com> --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53b4565..110dfdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,9 @@ on: push: pull_request: +permissions: + contents: read + jobs: tests: runs-on: ubuntu-latest From 76f8f6ecee2ebf1c7b2aa14721ffa96e0ec676c4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 May 2026 03:58:31 +0000 Subject: [PATCH 4/4] ci: test github actions against php 8.5 Agent-Logs-Url: https://github.com/voku/CssToInlineStyles/sessions/a1522433-fbb1-4e95-a015-5946613bd9e7 Co-authored-by: voku <264695+voku@users.noreply.github.com> --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 110dfdd..095898b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] steps: - uses: actions/checkout@v4 @@ -36,7 +36,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: '8.3' + php-version: '8.5' coverage: none tools: composer:v2 @@ -52,7 +52,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: '8.3' + php-version: '8.5' coverage: xdebug tools: composer:v2