Skip to content

Commit

Permalink
Udpate for PHP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksagona committed Nov 15, 2022
1 parent 9e18531 commit d967bc7
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 21 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
],
"require": {
"php": ">=7.3.0"
"php": ">=7.4.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/Range.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
8 changes: 8 additions & 0 deletions tests/PaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('<div class="link-off"><span>1</span></div>', $links[0]);
$this->assertEquals('<div class="link-on"><a href="?page=2">2</a></div>', $links[1]);
}

public function testGetRange()
{
$_SERVER['REQUEST_URI'] = '/pages.php';
Expand Down

0 comments on commit d967bc7

Please sign in to comment.