nur-sery/nur_tests/mapper/base/MapperAggregateTest.php

21 lines
514 B
PHP

<?php
namespace nur\mapper\base;
use nur\mapper\base\impl\MultMapper;
use nur\mapper\base\impl\PlusOneMapper;
use nur\mapper\base\impl\ResultConsumer;
use nur\t\TestCase;
class MapperAggregateTest extends TestCase {
function testMapper() {
$mapper = new MapperAggregate();
$mapper->add(PlusOneMapper::class);
$mapper->add(MultMapper::class);
$consumer = new ResultConsumer([1, 2, 3], $mapper);
$consumer->consume();
self::assertSame([2, 4, 3, 6, 4, 8], $consumer->getResult());
}
}