Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Update to Laravel 6, PHPUnit 8 and new Travis CI code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
letrunghieu committed Oct 12, 2019
1 parent 42d0f50 commit 5c6fa9d
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ composer.lock
.DS_Store
/nbproject/private/
/.idea
/.phpunit.result.cache
14 changes: 6 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@ sudo: false

language: php

dist: trusty

php:
- 7.0

env:
- LARAVEL_VERSION="5.5.*"
- 7.2
- 7.3

before_script:
- composer self-update
- composer require laravel/framework:$LARAVEL_VERSION --no-update
- composer install --prefer-source --no-interaction
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build

script:
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml

after_script:
- vendor/bin/test-reporter
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Active for Laravel
[![Total Downloads](https://poser.pugx.org/hieu-le/active/downloads.svg)](https://packagist.org/packages/hieu-le/active)
[![License](https://poser.pugx.org/hieu-le/active/license.svg)](https://packagist.org/packages/hieu-le/active)

The helper class for Laravel applications (both L4 and L5) to get active class base on current url.
The helper class for Laravel applications to get active class base on current url.

This README file is written for the new `3.x` version of this package, which is compatible with the Laravel 5 only.
This README file is written for the new `4.x` version of this package, which is compatible with the Laravel 6 only.

* If you are using Laravel 4, see the [`1.x` versions](https://github.com/letrunghieu/active/tree/support/1.x).
* If you are using Laravel 5 with the legacy `2.x` version of this package, you can give a try with the `3.x` version (whose API is changed totally) or continue with the [`2.x` version](https://github.com/letrunghieu/active/tree/support/2.x).
* If you are using Laravel 5, see the [`3.x` versions](https://github.com/letrunghieu/active/tree/support/3.x)

## Installation

Expand Down Expand Up @@ -41,6 +41,7 @@ See: [How to use Active](https://www.hieule.info/?p=377)

## Changelog:

* v4.0: support Laravel 6 and PHPUnit 8
* v3.5: support Laravel 5.5.x and PHPUnit 6
* v3.4: support Laravel 5.4.x
* v3.3: support Laravel 5.3.x
Expand Down
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hieu-le/active",
"description": "The helper class for Laravel (4/5) applications to get active class base on current route",
"description": "The helper class for Laravel applications to get active class base on current route",
"keywords": [
"laravel",
"active",
Expand All @@ -16,13 +16,12 @@
}
],
"require": {
"php": ">=7.0",
"laravel/framework": "^5.5"
"php": ">=7.2",
"laravel/framework": "^6.0"
},
"require-dev": {
"phpunit/phpunit": "~6.0",
"codeclimate/php-test-reporter": "dev-master",
"orchestra/testbench": "^3.1"
"phpunit/phpunit": "^8.0",
"orchestra/testbench": "^4.0"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
Expand Down
8 changes: 3 additions & 5 deletions src/Active.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*
* @package HieuLe\Active
* @author Hieu Le <[email protected]>
* @version 3.2.0
*
*/
class Active
{
Expand Down Expand Up @@ -138,7 +136,7 @@ public function checkUri($uris)
}

/**
* Check if the current URI matches one of specific patterns (using `str_is`)
* Check if the current URI matches one of specific patterns (using `Str::is`)
*
* @param array|string $patterns
*
Expand All @@ -151,7 +149,7 @@ public function checkUriPattern($patterns)
}

foreach ((array)$patterns as $p) {
if (str_is($p, $this->uri)) {
if (Str::is($p, $this->uri)) {
return true;
}
}
Expand Down Expand Up @@ -233,7 +231,7 @@ public function checkRoutePattern($patterns)
}

foreach ((array)$patterns as $p) {
if (str_is($p, $routeName)) {
if (Str::is($p, $routeName)) {
return true;
}
}
Expand Down
18 changes: 5 additions & 13 deletions src/ActiveServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,11 @@ public function boot()
{
// Update the instances each time a request is resolved and a route is matched
$instance = app('active');
if (version_compare(Application::VERSION, '5.2.0', '>=')) {
app('router')->matched(
function (RouteMatched $event) use ($instance) {
$instance->updateInstances($event->route, $event->request);
}
);
} else {
app('router')->matched(
function ($route, $request) use ($instance) {
$instance->updateInstances($route, $request);
}
);
}
app('router')->matched(
function (RouteMatched $event) use ($instance) {
$instance->updateInstances($event->route, $event->request);
}
);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function if_uri($uris)

if (!function_exists('if_uri_pattern')) {
/**
* Check if the current URI matches one of specific patterns (using `str_is`)
* Check if the current URI matches one of specific patterns (using `Str::is`)
*
* @param array|string $patterns
*
Expand Down
Empty file removed tests/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion tests/ActiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class ActiveTest extends TestCase
{

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down

0 comments on commit 5c6fa9d

Please sign in to comment.