diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 2c23bd4..cd666ae 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -14,7 +14,7 @@ env: jobs: coding-standards: name: "CS Fixer & PHPStan" - runs-on: "ubuntu-18.04" + runs-on: "ubuntu-20.04" strategy: matrix: diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 42b2d41..1424248 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -14,7 +14,7 @@ env: jobs: phpunit: name: "PHPUnit (PHP ${{ matrix.php }})" - runs-on: "ubuntu-18.04" + runs-on: "ubuntu-20.04" strategy: matrix: @@ -25,6 +25,7 @@ jobs: - "7.2" - "7.3" - "7.4" + - "8.0" steps: - name: "Checkout" @@ -65,7 +66,7 @@ jobs: phpunit-coverage: name: "PHPUnit coverage (PHP ${{ matrix.php }})" - runs-on: "ubuntu-18.04" + runs-on: "ubuntu-20.04" strategy: matrix: @@ -118,7 +119,7 @@ jobs: phpunit-lowest: name: "PHPUnit lowest deps (PHP ${{ matrix.php }})" - runs-on: "ubuntu-18.04" + runs-on: "ubuntu-20.04" strategy: matrix: @@ -161,7 +162,7 @@ jobs: phpunit-composerv2: name: "PHPUnit with Composer v2 (PHP ${{ matrix.php }})" - runs-on: "ubuntu-18.04" + runs-on: "ubuntu-20.04" strategy: matrix: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2ed6a99..0000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ -dist: xenial -os: linux -language: php - -# avoid double Travis build when the PR is created on upstream -if: | - type = pull_request OR \ - branch = master - -jobs: - include: - - php: 8.0 - env: SYMFONY_PHPUNIT_VERSION=7.5 - fast_finish: true - allow_failures: - - php: 8.0 - -cache: - directories: - - $HOME/.composer/cache/files - -before_install: - - if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi; - -install: - - if [ "$CS_FIXER" != "run" ]; then composer remove friendsofphp/php-cs-fixer --dev --no-progress --no-update ; fi; - - composer update --prefer-dist --no-progress -o - - php vendor/bin/simple-phpunit install - -before_script: - - mkdir -p build/logs - -script: - - php vendor/bin/simple-phpunit -v diff --git a/README.md b/README.md index a1eebee..e3f3cf7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Readability ![CI](https://github.com/j0k3r/php-readability/workflows/CI/badge.svg) -[![Build Status](https://travis-ci.org/j0k3r/php-readability.svg?branch=master)](https://travis-ci.org/j0k3r/php-readability) [![Coverage Status](https://coveralls.io/repos/j0k3r/php-readability/badge.svg?branch=master&service=github)](https://coveralls.io/github/j0k3r/php-readability/?branch=master) [![Total Downloads](https://poser.pugx.org/j0k3r/php-readability/downloads)](https://packagist.org/packages/j0k3r/php-readability) [![License](https://poser.pugx.org/j0k3r/php-readability/license)](https://packagist.org/packages/j0k3r/php-readability) diff --git a/src/Readability.php b/src/Readability.php index 1ed93ea..db2e27a 100644 --- a/src/Readability.php +++ b/src/Readability.php @@ -187,6 +187,9 @@ public function __construct($html, $url = null, $parser = 'libxml', $use_tidy = $this->loadHtml(); } + /** + * @return void + */ public function setLogger(LoggerInterface $logger) { $this->logger = $logger; diff --git a/tests/ReadabilityTest.php b/tests/ReadabilityTest.php index e345947..dfe3cf6 100644 --- a/tests/ReadabilityTest.php +++ b/tests/ReadabilityTest.php @@ -74,7 +74,7 @@ public function testInitNoContent() $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); $this->assertEmpty($readability->getTitle()->getInnerHtml()); - $this->assertContains('Sorry, Readability was unable to parse this page for content.', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('Sorry, Readability was unable to parse this page for content.', $readability->getContent()->getInnerHtml()); } public function testInitP() @@ -85,9 +85,9 @@ public function testInitP() $this->assertTrue($res); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); - $this->assertContains('
getContent()->getInnerHtml()); + $this->assertStringContainsString('This is the awesome content :)', $readability->getContent()->getInnerHtml()); } public function testInitDivP() @@ -98,9 +98,9 @@ public function testInitDivP() $this->assertTrue($res); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); - $this->assertContains('
getContent()->getInnerHtml()); + $this->assertStringContainsString('This is the awesome content :)', $readability->getContent()->getInnerHtml()); } public function testInitDiv() @@ -112,9 +112,9 @@ public function testInitDiv() $this->assertTrue($res); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); - $this->assertContains('
getContent()->getInnerHtml()); + $this->assertStringContainsString('This is the awesome content :)', $readability->getContent()->getInnerHtml()); } public function testWithFootnotes() @@ -127,11 +127,11 @@ public function testWithFootnotes() $this->assertTrue($res); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); - $this->assertContains('
getContent()->getInnerHtml()); - $this->assertContains('readabilityFootnoteLink', $readability->getContent()->getInnerHtml()); - $this->assertContains('readabilityLink-3', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('readabilityFootnoteLink', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('readabilityLink-3', $readability->getContent()->getInnerHtml()); } public function testStandardClean() @@ -144,11 +144,11 @@ public function testStandardClean() $this->assertTrue($res); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); - $this->assertContains('
getContent()->getInnerHtml()); - $this->assertContains('will NOT be removed', $readability->getContent()->getInnerHtml()); - $this->assertNotContains('

', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('will NOT be removed', $readability->getContent()->getInnerHtml()); + $this->assertStringNotContainsString('

', $readability->getContent()->getInnerHtml()); } public function testWithIframe() @@ -160,10 +160,10 @@ public function testWithIframe() $this->assertTrue($res); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); - $this->assertContains('
getContent()->getInnerHtml()); - $this->assertContains('nofollow', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('nofollow', $readability->getContent()->getInnerHtml()); } public function testWithArticle() @@ -175,10 +175,10 @@ public function testWithArticle() $this->assertTrue($res); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); - $this->assertContains('alt="article"', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('alt="article"', $readability->getContent()->getInnerHtml()); $this->assertEmpty($readability->getTitle()->getInnerHtml()); - $this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); - $this->assertContains('nofollow', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); + $this->assertStringContainsString('nofollow', $readability->getContent()->getInnerHtml()); } public function testWithAside() @@ -191,9 +191,9 @@ public function testWithAside() $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getContent()); $this->assertInstanceOf('Readability\JSLikeHTMLElement', $readability->getTitle()); $this->assertEmpty($readability->getTitle()->getInnerHtml()); - $this->assertContains('This is an awesome text with some links, here there are', $readability->getContent()->getInnerHtml()); - $this->assertNotContains('