Skip to content
Snippets Groups Projects
Unverified Commit c968b45c authored by Thomas Flori's avatar Thomas Flori
Browse files

throw NotFound exception in factory

parent 3dab365f
No related branches found
No related tags found
No related merge requests found
......@@ -116,7 +116,7 @@ class Factory
}
if (!$viewLocator->has($name)) {
throw new \Exception('View ' . $name . ' not found');
throw new NotFound('View ' . $name . ' not found');
}
if (is_string($layout)) {
......@@ -148,7 +148,7 @@ class Factory
return call_user_func($function, ...$arguments);
}
throw new \Exception('$function has to be callable or a registered view helper');
throw new NotFound('$function has to be callable or a registered view helper');
}
/**
......
......@@ -5,6 +5,7 @@ namespace Syna\Test;
use Syna\Factory;
use Mockery as m;
use Syna\HelperLocator;
use Syna\NotFound;
use Syna\View;
use Syna\ViewHelper\CallableHelper;
use Syna\ViewLocator;
......@@ -84,7 +85,7 @@ class FactoryTest extends TestCase
$viewLocator->shouldReceive('has')->with('viewName')
->once()->ordered()->andReturn(false);
self::expectException(\Exception::class);
self::expectException(NotFound::class);
self::expectExceptionMessage('View viewName not found');
$factory->view('viewName');
......@@ -132,7 +133,7 @@ class FactoryTest extends TestCase
$helperLocator->shouldReceive('has')->with('helperName')
->once()->ordered()->andReturn(false);
self::expectException(\Exception::class);
self::expectException(NotFound::class);
self::expectExceptionMessage('$function has to be callable or a registered view helper');
$factory->helper($view, 'helperName', 'argument1');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment