public function testRegistration() { $this->assertFalse($this->filterGroup->isRegistered()); $this->routingMock->expects($this->once())->method('filter'); $this->resolverMock->expects($this->once())->method('methodToClosure'); $this->filterGroup->register($this->routingMock, $this->resolverMock); $this->assertTrue($this->filterGroup->isRegistered()); }
public function register(Router $router, Resolver $resolver) { $reflection = new ReflectionMethodsFilter($this); foreach ($methods = $reflection->filterPrefix($this->getPrefix()) as $method) { $router->filter($method, $resolver->methodToClosure($this, $method)); } $this->registered = true; }
public function testMethod() { $this->prepareApplication(); $testValue = uniqid("testValue"); $expect = [$testValue, $this]; $pass = [$testValue]; $this->assertSame($expect, $this->resolver->method($this, 'injectionTesting', $pass)); $this->assertSame($expect, $this->resolver->method($this, 'scopeInjectionTesting', $pass, true)); try { $this->assertSame($expect, $this->resolver->method($this, 'scopeInjectionTesting', $pass)); } catch (\Exception $e) { $this->assertInstanceOf('Exception', $e); } $closure = $this->resolver->methodToClosure($this, 'injectionTesting'); $this->assertSame($expect, $closure($testValue)); $this->assertSame($expect, $this->resolver->resolveMethodParameters($this, 'injectionTesting', $pass)); }