tests/Form/EventListener/FormatterListenerTest.php
/**
     * NEXT_MAJOR: Remove the group when deleting FormatterInterface.
     *
     * @group legacy
     */
Remove the group when deleting FormatterInterface.
@group legacy
Remove the group when deleting FormatterInterface . @group legacy
public function testWithValidFormatter(): void
    {
        $formatter = $this->createMock(FormatterInterface::class);
        $formatter->expects(static::once())->method('transform')->willReturnCallback(static function ($text) {
            return strtoupper($text);
        });
        $pool = $this->getPool();
        $pool->add('myformat', $formatter);
        $listener = new FormatterListener($pool, '[format]', '[source]', '[target]');
        $event = new FormEvent($this->createMock(FormInterface::class), [
            'format' => 'myformat',
            'source' => 'data',
            'target' => null,
        ]);
        $listener->postSubmit($event);
        $expected = [
            'format' => 'myformat',
            'source' => 'data',
            'target' => 'DATA',
        ];
        static::assertSame($expected, $event->getData());
    }
public function testWithValidFormatter ( ) : void { $ formatter = $ this -> createMock ( FormatterInterface :: class ) ; $ formatter -> expects ( static :: once ( ) ) -> method ( 'transform' ) -> willReturnCallback ( static function ( $ text ) { return strtoupper ( $ text ) ; } ) ; $ pool = $ this -> getPool ( ) ; $ pool -> add ( 'myformat' , $ formatter ) ; $ listener = new FormatterListener ( $ pool , '[format]' , '[source]' , '[target]' ) ; $ event = new FormEvent ( $ this -> createMock ( FormInterface :: class ) , [ 'format' => 'myformat' , 'source' => 'data' , 'target' => null , ] ) ; $ listener -> postSubmit ( $ event ) ; $ expected = [ 'format' => 'myformat' , 'source' => 'data' , 'target' => 'DATA' , ] ; static :: assertSame ( $ expected , $ event -> getData ( ) ) ; }
NEXT_MAJOR: Remove the group when deleting FormatterInterface.
NEXT_MAJOR : Remove the group when deleting FormatterInterface .