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

Commit

Permalink
2.0.0 readiness
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmoussa committed Jan 7, 2017
2 parents 34677eb + 14f8e8e commit 8a6713c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .docheader
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @see https://github.com/zendframework/zend-expressive-router for the canonical source repository
* @copyright Copyright (c) %regexp:(20\d{2}-)?%%year% Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) %regexp:(20\d{2}-)?20\d{2}% Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-expressive-router/blob/master/LICENSE.md New BSD License
*/
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@ 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 ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then composer check-coverage ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer cs ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer license-check ; fi

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

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 - 2017-01-06

### Added

- [#6](https://github.com/zendframework/zend-expressive-router/pull/6) modifies `RouterInterface::generateUri` to
support an `$options` parameter, which may pass additional configuration options to the actual router.
- [#21](https://github.com/zendframework/zend-expressive-router/pull/21) makes the configured path definition
accessible in the `RouteResult`.

### Deprecated

- Nothing.

### Removed

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

### Fixed

Expand Down
5 changes: 3 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 Expand Up @@ -47,6 +47,7 @@
"@license-check",
"@test"
],
"check-coverage": "vendor/bin/php-coverage-checker clover.xml 100",
"coveralls": "coveralls -v",
"cs": "phpcs",
"cs-fix": "phpcbf",
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 8a6713c

Please sign in to comment.