public function testCliAuditWithLocalIPAddress() { unset($_SERVER["REMOTE_ADDR"]); $config = new Configuration(); $config->setCurrentUser($this->ZfcUserMock); $ipaddress = $config->getIpAddress(); $this->assertEquals("127.0.0.1", $ipaddress); }
public function setUp() { $this->Bootstrap = new Bootstrap(); $this->em = $this->Bootstrap->getServiceManager()->get("doctrine.entitymanager.orm_default"); /// echo sql logger //$this->em->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());; /// let's create the default user $this->ZfcUserMock = $this->createUser(); $auditConfig = new Configuration(); $auditConfig->setCurrentUser($this->ZfcUserMock); $auditConfig->setAuditedEntityClasses(array('ZF2EntityAuditTest\\Entity\\Article', 'ZF2EntityAuditTest\\Entity\\Writer')); $auditConfig->setNote("default note"); $this->auditManager = new Manager($auditConfig); $this->auditManager->registerEvents($this->em->getEventManager()); /// creating the tables $this->schemaTool = $this->getSchemaTool(); $this->schemaTool->createSchema(array($this->em->getClassMetadata('ZF2EntityAuditTest\\Entity\\Article'), $this->em->getClassMetadata('ZF2EntityAuditTest\\Entity\\Writer'))); }