test rewriting exception

This commit is contained in:
Etienne Roudeix
2013-09-04 08:16:25 +02:00
parent a47ef40996
commit 9a537b69d3

View File

@@ -52,6 +52,18 @@ class RewritingResolverTest extends \PHPUnit_Framework_TestCase
return $property;
}
/**
* @expectedException \Thelia\Exception\UrlRewritingException
* @expectedExceptionCode 800
*/
public function testGetOtherParametersException()
{
$resolver = new RewritingResolver();
$method = $this->getMethod('getOtherParameters');
$actual = $method->invoke($resolver);
}
public function testGetOtherParameters()
{
$rewritingArguments = array(
@@ -80,6 +92,29 @@ class RewritingResolverTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $actual);
}
/**
* @expectedException \Thelia\Exception\UrlRewritingException
* @expectedExceptionCode 404
*/
public function testLoadException()
{
$collection = new ObjectCollection();
$collection->setModel('\Thelia\Model\RewritingArgument');
$resolverQuery = $this->getMock('\Thelia\Model\RewritingUrlQuery', array('getResolverSearch'));
$resolverQuery->expects($this->any())
->method('getResolverSearch')
->with('foo.html')
->will($this->returnValue($collection));
$resolver = new RewritingResolver();
$rewritingUrlQuery = $this->getProperty('rewritingUrlQuery');
$rewritingUrlQuery->setValue($resolver, $resolverQuery);
$resolver->load('foo.html');
}
public function testLoad()
{
$collection = new ObjectCollection();