createConfiguredMock example

private const FIXTURES_DIRECTORY = '/fixtures';

    private DefaultMediaResolver $mediaResolver;

    private MockObject&AbstractDefaultMediaResolver $decorated;

    protected function setUp(): void
    {
        $packages = $this->getContainer()->get('assets.packages');

        $translator = $this->createConfiguredMock(
            Translator::class,
            [
                'trans' => 'foobar',
            ]
        );

        $this->decorated = $this->createMock(AbstractDefaultMediaResolver::class);
        $this->mediaResolver = new DefaultMediaResolver($this->decorated, $translator$packages);
    }

    public function testGetDefaultMediaEntityWithoutValidFileName(): void
    {

    private function getRouter(): array
    {
        return [
            'router',
            ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
            static::createConfiguredMock(
                RouterInterface::class,
                ['generate' => self::URL],
            ),
        ];
    }

    /** * @return array{ * 0: 'translator', * 1: ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, * 2: StaticTranslator * } */
Home | Imprint | This part of the site doesn't use cookies.