Skip to content

Commit b668fef

Browse files
author
Max Baldanza
committed
Add specs for locator factory
1 parent e1f447f commit b668fef

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace spec\MageTest\PhpSpec\MagentoExtension\Extension;
4+
5+
use MageTest\PhpSpec\MagentoExtension\Extension\LocatorFactory;
6+
use MageTest\PhpSpec\MagentoExtension\Locator\Magento\BlockLocator;
7+
use MageTest\PhpSpec\MagentoExtension\Locator\Magento\ControllerLocator;
8+
use MageTest\PhpSpec\MagentoExtension\Locator\Magento\HelperLocator;
9+
use MageTest\PhpSpec\MagentoExtension\Locator\Magento\ModelLocator;
10+
use PhpSpec\ObjectBehavior;
11+
use Prophecy\Argument;
12+
13+
class LocatorFactorySpec extends ObjectBehavior
14+
{
15+
function it_should_get_block_locator()
16+
{
17+
$this->getLocator('block')->shouldHaveType(BlockLocator::class);
18+
}
19+
20+
function it_should_get_model_locator()
21+
{
22+
$this->getLocator('model')->shouldHaveType(ModelLocator::class);
23+
}
24+
25+
function it_should_get_helper_locator()
26+
{
27+
$this->getLocator('helper')->shouldHaveType(HelperLocator::class);
28+
}
29+
30+
function it_should_get_controller_locator()
31+
{
32+
$this->getLocator('controller')->shouldHaveType(ControllerLocator::class);
33+
}
34+
35+
function it_should_throw_exception_when_an_unrecognised_type_is_used()
36+
{
37+
$this->shouldThrow(\RuntimeException::class)->duringGetLocator('foo');
38+
}
39+
}

0 commit comments

Comments
 (0)