FOF30\Factory\MagicSwitchFactory::transparentAuthentication PHP Метод

transparentAuthentication() публичный Метод

Creates a new TransparentAuthentication
public transparentAuthentication ( array $config = [] ) : TransparentAuthentication
$config array The configuration values for the TransparentAuthentication object
Результат FOF30\TransparentAuthentication\TransparentAuthentication
    public function transparentAuthentication(array $config = array())
    {
        $toolbarClass = $this->container->getNamespacePrefix($this->getSection()) . 'TransparentAuthentication\\TransparentAuthentication';
        try {
            return $this->createTransparentAuthentication($toolbarClass, $config);
        } catch (TransparentAuthenticationNotFound $e) {
            // Not found. Let's go on.
        }
        $toolbarClass = $this->container->getNamespacePrefix('inverse') . 'TransparentAuthentication\\TransparentAuthentication';
        try {
            return $this->createTransparentAuthentication($toolbarClass, $config);
        } catch (TransparentAuthenticationNotFound $e) {
            // Not found. Return the magically created TransparentAuthentication
            $magic = new TransparentAuthenticationFactory($this->container);
            // Let's pass the section override (if any)
            $magic->setSection($this->getSection());
            return $magic->make($config);
        }
    }

Usage Example

Пример #1
0
 /**
  * @group           MagicSwitchFactory
  * @covers          FOF30\Factory\MagicSwitchFactory::transparentAuthentication
  * @dataProvider    MagicSwitchFactoryDataprovider::getTestTransparentAuthentication
  */
 public function testTransparentAuthentication($test, $check)
 {
     $msg = 'MagicSwitchFactory::transparentAuthentication %s - Case: ' . $check['case'];
     $container = new TestContainer(array('componentName' => $test['component'], 'backEndPath' => $test['backend_path']));
     $platform = $container->platform;
     $platform::$isAdmin = $test['backend'];
     // Required so we force FOF to read the fof.xml file
     $dummy = $container->appConfig;
     $factory = new MagicSwitchFactory($container);
     $result = $factory->transparentAuthentication();
     $this->assertEquals($check['result'], get_class($result), sprintf($msg, 'Returned the wrong result'));
 }