Skip to content

Commit cf3d1bd

Browse files
committed
Added Decorator and MapperAware test stubs.
1 parent dc7bc7c commit cf3d1bd

4 files changed

Lines changed: 56 additions & 0 deletions

File tree

test/DecoratorStub.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
namespace ScriptFUSIONTest;
3+
4+
use ScriptFUSION\Mapper\Strategy\Decorator;
5+
6+
final class DecoratorStub extends Decorator
7+
{
8+
public function getStrategyPublic()
9+
{
10+
return $this->getStrategy();
11+
}
12+
}

test/MapperAwareStub.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
namespace ScriptFUSIONTest;
3+
4+
use ScriptFUSION\Mapper\MapperAwareTrait;
5+
6+
final class MapperAwareStub
7+
{
8+
use MapperAwareTrait;
9+
10+
public function getMapperPublic()
11+
{
12+
return $this->getMapper();
13+
}
14+
}

test/Unit/Mapper/DecoratorTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
namespace ScriptFUSIONTest\Unit\Mapper;
3+
4+
use ScriptFUSION\Mapper\Strategy\Strategy;
5+
use ScriptFUSIONTest\DecoratorStub;
6+
7+
final class DecoratorTest extends \PHPUnit_Framework_TestCase
8+
{
9+
public function testGetStrategy()
10+
{
11+
$decorator = new DecoratorStub($strategy = \Mockery::mock(Strategy::class));
12+
13+
self::assertSame($strategy, $decorator->getStrategyPublic());
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
namespace ScriptFUSIONTest\Unit\Mapper;
3+
4+
use ScriptFUSION\Mapper\Mapper;
5+
use ScriptFUSIONTest\MapperAwareStub;
6+
7+
final class MapperAwareTraitTest extends \PHPUnit_Framework_TestCase
8+
{
9+
public function testGetMapper()
10+
{
11+
$mapperAware = (new MapperAwareStub)->setMapper($mapper = \Mockery::mock(Mapper::class));
12+
13+
self::assertSame($mapper, $mapperAware->getMapperPublic());
14+
}
15+
}

0 commit comments

Comments
 (0)