Skip to content
Draft
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
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
pull_request:

permissions:
contents: read

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', '8.4', '8.5']

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.5'
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.5'
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
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
[![PHP 7 ready](http://php7ready.timesplinter.ch/voku/CssToInlineStyles/badge.svg)](https://travis-ci.org/voku/CssToInlineStyles)
[![License](https://poser.pugx.org/voku/css-to-inline-styles/license)](https://packagist.org/packages/voku/css-to-inline-styles)

# CssToInlineStyles class
Expand Down Expand Up @@ -74,4 +73,3 @@ $cssToInlineStyles->setCleanup(true);
## Known issues

* no support for pseudo selectors

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
24 changes: 13 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<phpunit bootstrap="tests/bootstrap.php">
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<phpunit bootstrap="tests/bootstrap.php"
colors="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd">
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</include>
</coverage>
</phpunit>
20 changes: 10 additions & 10 deletions tests/CssToInlineStylesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -521,7 +521,7 @@ public function testXHTMLOutput()
$this->cssToInlineStyles->setCSS($css);
$actual = $this->cssToInlineStyles->convert(true);

static::assertContains('<img></img>', $actual);
static::assertStringContainsString('<img></img>', $actual);
}

public function testCleanup()
Expand Down Expand Up @@ -602,14 +602,14 @@ public function testEncodingIso()
$this->cssToInlineStyles->setEncoding('ISO-8859-1');
$result = $this->runHTMLToCSS($html, $css, $expected);

static::assertContains('<p>H', $result);
static::assertContains('Iñtërnâtiônàlizætiøn', $result);
static::assertStringContainsString('<p>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 = '<p>' . $testString . '</p>';
$css = '';
Expand All @@ -618,13 +618,13 @@ public function testEncodingUtf8()
$this->cssToInlineStyles->setEncoding('UTF-8');
$result = $this->runHTMLToCSS($html, $css, $expected);

static::assertContains('<p>Hírek', $result);
static::assertContains('Iñtërnâtiônàlizætiøn', $result);
static::assertStringContainsString('<p>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('');
Expand All @@ -640,7 +640,7 @@ public function testXMLHeaderIsRemoved()
$this->cssToInlineStyles->setHTML($html);
$this->cssToInlineStyles->setCSS('');

static::assertNotContains('<?xml', $this->cssToInlineStyles->convert(true));
static::assertStringNotContainsString('<?xml', $this->cssToInlineStyles->convert(true));
}

public function testXMLHeaderIsRemovedv2()
Expand Down
Loading