mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-04 05:59:55 +09:00
update to laravel 5.7 and try getting autologin saved
This commit is contained in:
@@ -13,13 +13,14 @@ namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
|
||||
use Symfony\Component\DependencyInjection\ChildDefinition;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\DependencyInjection\ServiceLocator;
|
||||
use Symfony\Component\DependencyInjection\TypedReference;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass;
|
||||
|
||||
class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
@@ -140,15 +141,15 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
|
||||
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
|
||||
|
||||
$this->assertEquals(array('foo:fooAction'), array_keys($locator));
|
||||
$this->assertInstanceof(ServiceClosureArgument::class, $locator['foo:fooAction']);
|
||||
$this->assertEquals(array('foo::fooAction'), array_keys($locator));
|
||||
$this->assertInstanceof(ServiceClosureArgument::class, $locator['foo::fooAction']);
|
||||
|
||||
$locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]);
|
||||
$locator = $container->getDefinition((string) $locator['foo::fooAction']->getValues()[0]);
|
||||
|
||||
$this->assertSame(ServiceLocator::class, $locator->getClass());
|
||||
$this->assertFalse($locator->isPublic());
|
||||
|
||||
$expected = array('bar' => new ServiceClosureArgument(new TypedReference(ControllerDummy::class, ControllerDummy::class, RegisterTestController::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)));
|
||||
$expected = array('bar' => new ServiceClosureArgument(new TypedReference(ControllerDummy::class, ControllerDummy::class, ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE)));
|
||||
$this->assertEquals($expected, $locator->getArgument(0));
|
||||
}
|
||||
|
||||
@@ -166,9 +167,9 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
$pass->process($container);
|
||||
|
||||
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
|
||||
$locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]);
|
||||
$locator = $container->getDefinition((string) $locator['foo::fooAction']->getValues()[0]);
|
||||
|
||||
$expected = array('bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, RegisterTestController::class)));
|
||||
$expected = array('bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE)));
|
||||
$this->assertEquals($expected, $locator->getArgument(0));
|
||||
}
|
||||
|
||||
@@ -185,9 +186,9 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
$pass->process($container);
|
||||
|
||||
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
|
||||
$locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]);
|
||||
$locator = $container->getDefinition((string) $locator['foo::fooAction']->getValues()[0]);
|
||||
|
||||
$expected = array('bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, RegisterTestController::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)));
|
||||
$expected = array('bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE)));
|
||||
$this->assertEquals($expected, $locator->getArgument(0));
|
||||
}
|
||||
|
||||
@@ -203,7 +204,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
$pass->process($container);
|
||||
|
||||
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
|
||||
$this->assertSame(array('foo:fooAction'), array_keys($locator));
|
||||
$this->assertSame(array('foo::fooAction'), array_keys($locator));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -250,7 +251,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
$pass->process($container);
|
||||
|
||||
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
|
||||
$this->assertSame(array('foo:barAction', 'foo:fooAction'), array_keys($locator));
|
||||
$this->assertSame(array('foo::barAction', 'foo::fooAction'), array_keys($locator));
|
||||
}
|
||||
|
||||
public function testArgumentWithNoTypeHintIsOk()
|
||||
@@ -300,7 +301,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
|
||||
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
|
||||
|
||||
$locator = $container->getDefinition((string) $locator['foo:fooAction']->getValues()[0]);
|
||||
$locator = $container->getDefinition((string) $locator['foo::fooAction']->getValues()[0]);
|
||||
|
||||
$expected = array('bar' => new ServiceClosureArgument(new Reference('foo')));
|
||||
$this->assertEquals($expected, $locator->getArgument(0));
|
||||
@@ -311,7 +312,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
return array(array(ControllerDummy::class), array('$bar'));
|
||||
}
|
||||
|
||||
public function testDoNotBindScalarValueToControllerArgument()
|
||||
public function testBindScalarValueToControllerArgument()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$resolver = $container->register('argument_resolver.service')->addArgument(array());
|
||||
@@ -320,11 +321,47 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase
|
||||
->setBindings(array('$someArg' => '%foo%'))
|
||||
->addTag('controller.service_arguments');
|
||||
|
||||
$container->setParameter('foo', 'foo_val');
|
||||
|
||||
$pass = new RegisterControllerArgumentLocatorsPass();
|
||||
$pass->process($container);
|
||||
|
||||
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
|
||||
$this->assertEmpty($locator);
|
||||
|
||||
$locator = $container->getDefinition((string) $locator['foo::fooAction']->getValues()[0]);
|
||||
|
||||
// assert the locator has a someArg key
|
||||
$arguments = $locator->getArgument(0);
|
||||
$this->assertArrayHasKey('someArg', $arguments);
|
||||
$this->assertInstanceOf(ServiceClosureArgument::class, $arguments['someArg']);
|
||||
// get the Reference that someArg points to
|
||||
$reference = $arguments['someArg']->getValues()[0];
|
||||
// make sure this service *does* exist and returns the correct value
|
||||
$this->assertTrue($container->has((string) $reference));
|
||||
$this->assertSame('foo_val', $container->get((string) $reference));
|
||||
}
|
||||
|
||||
public function testBindingsOnChildDefinitions()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$resolver = $container->register('argument_resolver.service')->addArgument(array());
|
||||
|
||||
$container->register('parent', ArgumentWithoutTypeController::class);
|
||||
|
||||
$container->setDefinition('child', (new ChildDefinition('parent'))
|
||||
->setBindings(array('$someArg' => new Reference('parent')))
|
||||
->addTag('controller.service_arguments')
|
||||
);
|
||||
|
||||
$pass = new RegisterControllerArgumentLocatorsPass();
|
||||
$pass->process($container);
|
||||
|
||||
$locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0);
|
||||
$this->assertInstanceOf(ServiceClosureArgument::class, $locator['child::fooAction']);
|
||||
|
||||
$locator = $container->getDefinition((string) $locator['child::fooAction']->getValues()[0])->getArgument(0);
|
||||
$this->assertInstanceOf(ServiceClosureArgument::class, $locator['someArg']);
|
||||
$this->assertEquals(new Reference('parent'), $locator['someArg']->getValues()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user