factory = new IpAddressMiddlewareFactory(); } /** * @test */ public function returnedInstanceIsProperlyConfigured() { $instance = $this->factory->__invoke(new ServiceManager(), ''); $ref = new ReflectionObject($instance); $checkProxyHeaders = $ref->getProperty('checkProxyHeaders'); $checkProxyHeaders->setAccessible(true); $trustedProxies = $ref->getProperty('trustedProxies'); $trustedProxies->setAccessible(true); $attributeName = $ref->getProperty('attributeName'); $attributeName->setAccessible(true); $this->assertTrue($checkProxyHeaders->getValue($instance)); $this->assertEquals([], $trustedProxies->getValue($instance)); $this->assertEquals(Visitor::REMOTE_ADDRESS_ATTR, $attributeName->getValue($instance)); } }