ChainPipe example


    public function __construct(
        private readonly DefinitionInstanceRegistry $definitionInstanceRegistry,
        private readonly SerializerRegistry $serializerRegistry,
        private readonly PrimaryKeyResolver $primaryKeyResolver
    ) {
    }

    public function create(ImportExportLogEntity $logEntity): AbstractPipe
    {
        $pipe = new ChainPipe([
            new EntityPipe(
                $this->definitionInstanceRegistry,
                $this->serializerRegistry,
                null,
                null,
                $this->primaryKeyResolver
            ),
            new KeyMappingPipe(),
        ]);

        return $pipe;
    }
/** * @internal */
#[Package('system-settings')] class ChainPipeTest extends TestCase
{
    public function testChainPipe(): void
    {
        $outerPipe = $this->createMock(AbstractPipe::class);
        $innerPipe = $this->createMock(AbstractPipe::class);

        $chainPipe = new ChainPipe([$outerPipe$innerPipe]);

        $data = [
            'foo' => 'bar',
        ];
        $config = new Config([][][]);

        $innerInCalled = false;

        $outerPipe->expects(static::once())->method('in')
            ->willReturnCallback(
                function DConfig $c$record) use ($config$data, &$innerInCalled) {
                    
Home | Imprint | This part of the site doesn't use cookies.