/** * @test some random methods in the install lib */ public function testInstallerMethods() { $this->assertTrue(App::import('lib', 'Installer.Installer'), 'Could not import the insatller lib'); $Installer = new InstallerLib(); $data = $Installer->getLicense(); $this->assertFalse(empty($data)); $this->assertEqual($data, $Installer->getLicense('html')); $this->assertEqual($data, $Installer->getLicense('fake')); $this->assertEqual($Installer->getLicense('text'), strip_tags($Installer->getLicense('text'))); $data = $Installer->getWelcome(); $this->assertFalse(empty($data)); $this->assertEqual($data, $Installer->getWelcome('html')); $this->assertEqual($data, $Installer->getWelcome('fakse')); $this->assertEqual($Installer->getWelcome('text'), strip_tags($Installer->getWelcome('text'))); $this->assertTrue(count($Installer->getSupportedDbs()) == 3); $this->assertTrue(count($Installer->getSupportedDbs(false)) == 3); $connection = array('connection' => array('persistent' => $this->db->config['persistent'], 'host' => $this->db->config['host'], 'login' => $this->db->config['login'], 'password' => $this->db->config['password'], 'database' => $this->db->config['database'], 'socket' => $this->db->config['socket'], 'driver' => $this->db->config['driver'], 'encoding' => $this->db->config['encoding'], 'port' => $this->db->config['port'])); $expected = $connection['connection']; if (!$expected['port']) { unset($expected['port']); } $this->assertEqual($expected, $Installer->cleanConnectionDetails($connection)); $this->assertTrue($Installer->testConnection($Installer->cleanConnectionDetails($connection)), 'Should connect'); $connection['connection']['login'] = '******'; $this->assertFalse($Installer->testConnection($Installer->cleanConnectionDetails($connection)), 'Should not connect'); $connection['root'] = array('login' => $this->db->config['login'], 'password' => $this->db->config['password']); $connection = $Installer->cleanConnectionDetails($connection); $this->assertEqual('test', $connection['login']); $this->assertFalse($Installer->testConnection($connection), 'Should not connect'); }