19 declare(strict_types=1);
    33 require_once __DIR__ . 
'/../ContainerMock.php';
    41         $this->assertInstanceOf(Marshal::class, 
new Marshal($this->mock(Refinery::class)));
    46         $from = $this->mock(Transformation::class);
    47         $custom = $this->mock(Transformation::class);
    48         $date = $this->mock(Transformation::class);
    50         $refinery = $this->mockTree(Refinery::class, [
    51             'in' => $this->mockMethod(In::class, 
'series', [[$custom, $date]], $from),
    52             'custom' => [
'transformation' => $custom],
    53             'to' => [
'dateTime' => $date],
    57         $this->assertSame($from, $convert->fromString());
    58         $this->assertSame($custom, $convert->toString());
    63         $from = $this->mock(ByTrying::class);
    64         $custom = $this->mock(Transformation::class);
    65         $bool = $this->mock(Transformation::class);
    66         $to = $this->mock(Transformation::class);
    68         $refinery = $this->mockTree(Refinery::class, [
    69             'custom' => [
'transformation' => $custom],
    70             'kindlyTo' => [
'string' => $to, 
'bool' => $bool],
    72         $refinery->expects(self::once())->method(
'byTrying')->with([$bool, $custom])->willReturn($from);
    75         $this->assertSame($from, $convert->fromString());
    76         $this->assertSame($to, $convert->toString());
    81         $decorate = $this->mockTree(Convert::class, [
    82             'fromString' => $this->mock(Transformation::class),
    83             'toString' => $this->mock(Transformation::class),
    86         $by_trying = $this->mock(ByTrying::class);
    87         $nice_null = $this->mock(Transformation::class);
    88         $null = $this->mock(Constraint::class);
    89         $always = $this->mock(Transformation::class);
    90         $series = $this->mock(Transformation::class);
    92         $refinery = $this->mockTree(Refinery::class, [
    93             'kindlyTo' => [
'null' => $nice_null],
    94             'in' => $this->mockMethod(In::class, 
'series', [[$null, $always]], $series),
    98         $consecutive = [[$nice_null, $decorate->fromString()], [$series, $decorate->toString()]];
    99         $refinery->expects(self::exactly(2))->method(
'byTrying')->with(
   100             $this->callback(
function ($value) use (&$consecutive) {
   101                 $this->assertSame(array_shift($consecutive), $value);
   104         )->willReturn($by_trying);
   107         $this->assertSame($by_trying, $convert->fromString());
   108         $this->assertSame($by_trying, $convert->toString());
   113         $id = $this->mock(Transformation::class);
   115         $convert = (
new Marshal($this->mockTree(Refinery::class, [
'identity' => 
$id])))->
string();
   116         $this->assertSame(
$id, $convert->fromString());
   117         $this->assertSame(
$id, $convert->toString());
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins