protected function mockMailer(array $config)
    {
        // options that make sense for mailer mock
        $allowedOptions = [
            'htmlLayout',
            'textLayout',
            'messageConfig',
            'messageClass',
            'useFileTransport',
            'fileTransportPath',
            'fileTransportCallback',
            'view',
            'viewPath',
        ];

        $mailerConfig = [
            'class' => TestMailer::class,
            'callback' => function (MessageInterface $message) {
                $this->emails[] = $message;
            }
        ];

        if (isset($config['components']['mailer']) && is_array($config['components']['mailer'])) {
            foreach ($config['components']['mailer'] as $name => $value) {
                if (in_array($name, $allowedOptions, true)) {
                    $mailerConfig[$name] = $value;
                }
            }
        }
        $config['components']['mailer'] = $mailerConfig;

        return $config;
    }
protected function mockMailer(array $config)
    {
        // options that make sense for mailer mock
        $allowedOptions = [
            'htmlLayout',
            'textLayout',
            'messageConfig',
            'messageClass',
            'useFileTransport',
            'fileTransportPath',
            'fileTransportCallback',
            'view',
            'viewPath',
        ];

        $mailerConfig = [
            'class' => TestMailer::class,
            'callback' => function (MessageInterface $message) {
                $this->emails[] = $message;
            }
        ];

        if (isset($config['components']['mailer']) && is_array($config['components']['mailer'])) {
            foreach ($config['components']['mailer'] as $name => $value) {
                if (in_array($name, $allowedOptions, true)) {
                    $mailerConfig[$name] = $value;
                }
            }
        }
        $config['components']['mailer'] = $mailerConfig;

        return $config;
    }
protected function mockMailer ( array $ config ) { // options that make sense for mailer mock $ allowedOptions = [ 'htmlLayout' , 'textLayout' , 'messageConfig' , 'messageClass' , 'useFileTransport' , 'fileTransportPath' , 'fileTransportCallback' , 'view' , 'viewPath' , ] ; $ mailerConfig = [ 'class' => TestMailer :: class , 'callback' => function ( MessageInterface $ message ) { $ this -> emails [ ] = $ message ; } ] ; if ( isset ( $ config [ 'components' ] [ 'mailer' ] ) && is_array ( $ config [ 'components' ] [ 'mailer' ] ) ) { foreach ( $ config [ 'components' ] [ 'mailer' ] as $ name => $ value ) { if ( in_array ( $ name , $ allowedOptions , true ) ) { $ mailerConfig [ $ name ] = $ value ; } } } $ config [ 'components' ] [ 'mailer' ] = $ mailerConfig ; return $ config ; }
Replace mailer with in memory mailer
@param array $config Original configuration
@return array New configuration
Replace mailer with in memory mailer