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

Commit

Permalink
Merge pull request #132 from eloipoch/change-default-strategy-to-404
Browse files Browse the repository at this point in the history
change default strategy to 404
  • Loading branch information
pablodip committed Dec 6, 2015
2 parents 9564083 + f2e3d22 commit e6b020f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
*/
class Configuration implements ConfigurationInterface
{
const EXCEPTION_STRATEGY_NONE = false;

const EXCEPTION_STRATEGY_TO_HTTP_NOT_FOUND = 'to_http_not_found';

/**
Expand All @@ -41,12 +39,12 @@ public function getConfigTreeBuilder()
->arrayNode('exceptions_strategy')
->addDefaultsIfNotSet()
->children()
->scalarNode('out_of_range_page')->defaultValue(self::EXCEPTION_STRATEGY_NONE)->end()
->scalarNode('not_valid_current_page')->defaultValue(self::EXCEPTION_STRATEGY_NONE)->end()
->scalarNode('out_of_range_page')->defaultValue(self::EXCEPTION_STRATEGY_TO_HTTP_NOT_FOUND)->end()
->scalarNode('not_valid_current_page')->defaultValue(self::EXCEPTION_STRATEGY_TO_HTTP_NOT_FOUND)->end()
->end()
->end()
->end();

return $treeBuilder;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function testOutOfRangeExceptionWithNoneStrategy()
$client->request('GET', $this->buildViewUrl('custom-page?currentPage=51'));

$response = $client->getResponse();
$this->assertSame(500, $response->getStatusCode());
$this->assertSame(404, $response->getStatusCode());
}

/**
Expand Down Expand Up @@ -221,7 +221,7 @@ public function testWrongMaxPerPageExceptionWithNoneStrategy()
$client->request('GET', $this->buildViewUrl('custom-page?maxPerPage=invalid'));

$response = $client->getResponse();
$this->assertSame(500, $response->getStatusCode());
$this->assertSame(404, $response->getStatusCode());
}

/**
Expand Down

0 comments on commit e6b020f

Please sign in to comment.