From d967bc7243d4a270ca6f3bb2c606f16df88d10bc Mon Sep 17 00:00:00 2001 From: Nick Sagona Date: Tue, 15 Nov 2022 09:17:10 -0600 Subject: [PATCH] Udpate for PHP 8 --- .github/workflows/phpunit.yml | 39 +++++++++++++++++++---------------- LICENSE.TXT | 2 +- composer.json | 2 +- src/Range.php | 2 +- tests/PaginatorTest.php | 8 +++++++ 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index c01359a..131ac45 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -10,28 +10,31 @@ jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + php-versions: [ '7.4', '8.0' ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - #- name: Validate composer.json and composer.lock - # run: composer validate + #- name: Validate composer.json and composer.lock + # run: composer validate - - name: Cache Composer packages - id: composer-cache - uses: actions/cache@v2 - with: - path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-php- + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- - - name: Install dependencies - if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer install --prefer-dist --no-progress --no-suggest + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest - # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" - # Docs: https://getcomposer.org/doc/articles/scripts.md + # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" + # Docs: https://getcomposer.org/doc/articles/scripts.md - - name: Run test suite - run: composer run-script test + - name: Run test suite + run: composer run-script test diff --git a/LICENSE.TXT b/LICENSE.TXT index b20d09a..686bb74 100644 --- a/LICENSE.TXT +++ b/LICENSE.TXT @@ -1,6 +1,6 @@ BSD 3 Clause License -Copyright (c) 2009-2021, NOLA Interactive, LLC. +Copyright (c) 2009-2023, NOLA Interactive, LLC. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/composer.json b/composer.json index c78f076..4023c97 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": ">=7.3.0" + "php": ">=7.4.0" }, "require-dev": { "phpunit/phpunit": "^9.0.0" diff --git a/src/Range.php b/src/Range.php index bff9145..e0068ed 100644 --- a/src/Range.php +++ b/src/Range.php @@ -240,7 +240,7 @@ public function __toString() if (empty($this->links)) { $this->getLinkRange(); } - return implode($this->separator, $this->links) . PHP_EOL; + return implode((string)$this->separator, $this->links) . PHP_EOL; } } diff --git a/tests/PaginatorTest.php b/tests/PaginatorTest.php index f849bb7..c70d50a 100644 --- a/tests/PaginatorTest.php +++ b/tests/PaginatorTest.php @@ -63,6 +63,14 @@ public function testSetBookends() $this->assertEquals('<<', $paginator->getBookends()['start']); } + public function testWrapLinks() + { + $paginator = Paginator::createRange(20); + $links = $paginator->wrapLinks('div', 'link-on', 'link-off'); + $this->assertEquals('', $links[0]); + $this->assertEquals('', $links[1]); + } + public function testGetRange() { $_SERVER['REQUEST_URI'] = '/pages.php';