Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmoussa committed Dec 24, 2016
2 parents 34677eb + 1c7411f commit 872f600
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 71 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@ matrix:
env:
- CS_CHECK=true
- php: 7.1
- php: hhvm
- php: hhvm
allow_failures:
- php: hhvm

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
- composer self-update
- if [[ $TEST_COVERAGE == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls:^1.0 ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then composer require --dev --no-update michaelmoussa/php-coverage-checker:^1.1.0 ; fi

install:
- travis_retry composer install --no-interaction
- composer info -i

script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage && vendor/bin/php-coverage-checker clover.xml 100 ; else composer test ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer cs ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer license-check ; fi

Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 2.0.0 - TBD
## 2.0.0 - 2016-12-??

### Added

Expand All @@ -15,7 +15,7 @@ All notable changes to this project will be documented in this file, in reverse

### Removed

- Nothing.
- Removed `RouteResultObserverInterface` and `RouteResultSubjectInterface`, as they were deprecated in 1.2.0.

### Fixed

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
],
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev",
"dev-develop": "2.0.x-dev"
"dev-master": "2.0-dev",
"dev-develop": "2.1-dev"
}
},
"require": {
Expand Down
20 changes: 0 additions & 20 deletions src/RouteResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,6 @@ public static function fromRoute(Route $route, array $params = [])
return $result;
}

/**
* Create an instance repesenting a route success.
*
* @deprecated since 1.3.0; will be removed in 2.0.0.
* @param string $name Name of matched route.
* @param callable|string $middleware Middleware associated with the
* matched route.
* @param array $params Parameters associated with the matched route.
* @return static
*/
public static function fromRouteMatch($name, $middleware, array $params)
{
$result = new self();
$result->success = true;
$result->matchedRouteName = $name;
$result->matchedMiddleware = $middleware;
$result->matchedParams = $params;
return $result;
}

/**
* Create an instance representing a route failure.
*
Expand Down
51 changes: 6 additions & 45 deletions test/RouteResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,12 @@ public function setUp()
};
}

public function testRouteMiddlewareIsRetrievable()
{
$result = RouteResult::fromRouteMatch(
'/foo',
$this->middleware,
[],
'/foo'
);
$this->assertSame($this->middleware, $result->getMatchedMiddleware());
}

public function testRouteMiddlewareIsNotRetrievable()
{
$result = RouteResult::fromRouteFailure();
$this->assertFalse($result->getMatchedMiddleware());
}

public function testRouteRouteNameIsRetrievable()
{
$result = RouteResult::fromRouteMatch(
'/foo',
$this->middleware,
[],
'/foo'
);
$this->assertEquals('/foo', $result->getMatchedRouteName());
}

public function testRouteNameIsNotRetrievable()
{
$result = RouteResult::fromRouteFailure();
Expand All @@ -70,26 +48,12 @@ public function testRouteFailureRetrieveHttpMethods()
$this->assertSame([], $result->getAllowedMethods());
}

public function testRouteRetrieveHttpMethods()
{
$result = RouteResult::fromRouteMatch(
'/foo',
$this->middleware,
[],
'/foo'
);
$this->assertSame([], $result->getAllowedMethods());
}

public function testRouteMatchedParams()
{
$params = ['foo' => 'bar'];
$result = RouteResult::fromRouteMatch(
'/foo',
$this->middleware,
$params,
'/foo'
);
$route = $this->prophesize(Route::class);
$result = RouteResult::fromRoute($route->reveal(), $params);

$this->assertSame($params, $result->getMatchedParams());
}

Expand All @@ -102,12 +66,9 @@ public function testRouteMethodFailure()
public function testRouteSuccessMethodFailure()
{
$params = ['foo' => 'bar'];
$result = RouteResult::fromRouteMatch(
'/foo',
$this->middleware,
$params,
'/foo'
);
$route = $this->prophesize(Route::class);
$result = RouteResult::fromRoute($route->reveal(), $params);

$this->assertFalse($result->isMethodFailure());
}

Expand Down

0 comments on commit 872f600

Please sign in to comment.