public function testIpLookupServiceInstantiation() { $ipFactory = new IpLookupFactory(array('bctest' => array('class' => 'Mautic\\CoreBundle\\Tests\\IpLookup\\BC\\BcIpLookup', 'display_name' => 'BC Test'))); $instance = $ipFactory->getService('bctest'); $this->assertInstanceOf('Mautic\\CoreBundle\\Tests\\IpLookup\\BC\\BcIpLookup', $instance, sprintf('Expected %s for service %s but received %s instead', 'Mautic\\CoreBundle\\Tests\\IpLookup\\BC\\BcIpLookup', 'bctest', get_class($instance))); $details = $instance->setIpAddress('1.2.3.4')->getDetails(); $this->assertEquals('San Francisco', $details['city']); }
public function testIpLookupServiceInstantiation() { static::bootKernel(); $ipServices = static::$kernel->getContainer()->getParameter('mautic.ip_lookup_services'); $ipFactory = new IpLookupFactory($ipServices); foreach ($ipServices as $service => $details) { $instance = $ipFactory->getService($service); $this->assertInstanceOf($details['class'], $instance, sprintf('Expected %s for service %s but received %s instead', $details['class'], $service, get_class($instance))); } }
public function createBcIpLookup() { $instance = $this->ipFactory->getService('bctest'); $this->assertInstanceOf('Mautic\\CoreBundle\\Tests\\IpLookup\\BC\\BcIpLookup', $instance, sprintf('Expected %s for service %s but received %s instead', 'Mautic\\CoreBundle\\Tests\\IpLookup\\BC\\BcIpLookup', 'bctest', get_class($instance))); return $instance; }