-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed key context propagation for delegate strategies.
N.B. Key propagation is still broken for Copy* strategies until they implement KeyAware.
- Loading branch information
Paul
committed
Jan 9, 2017
1 parent
202338a
commit da266a0
Showing
8 changed files
with
68 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
namespace ScriptFUSIONTest\Functional; | ||
|
||
use ScriptFUSION\Mapper\Mapper; | ||
use ScriptFUSION\Mapper\Strategy\Collection; | ||
use ScriptFUSION\Mapper\Strategy\Context; | ||
use ScriptFUSION\Mapper\Strategy\Copy; | ||
use ScriptFUSION\Mapper\Strategy\CopyContext; | ||
use ScriptFUSION\Mapper\Strategy\CopyKey; | ||
|
||
/** | ||
* Tests that the key context is correctly propagated through different expression types. | ||
*/ | ||
final class KeyPropagationTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testFragmentPropagation() | ||
{ | ||
$mapped = (new Mapper)->map( | ||
[ | ||
'foo' => [ | ||
'bar' => [], | ||
], | ||
], | ||
new Collection( | ||
new Copy('foo'), | ||
['foo' => new CopyKey] | ||
) | ||
); | ||
|
||
self::assertSame(['bar' => ['foo' => 'bar']], $mapped); | ||
} | ||
|
||
public function testStrategyPropagation() | ||
{ | ||
$mapped = (new Mapper)->map( | ||
[ | ||
'foo' => [ | ||
'bar' => [], | ||
], | ||
], | ||
new Collection( | ||
new Copy('foo'), | ||
new Context( | ||
new CopyContext, | ||
new CopyKey | ||
) | ||
) | ||
); | ||
|
||
self::assertSame(['bar' => 'bar'], $mapped); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters