* by implication, by FileMaker. * * Example PHP script to illustrate how to list databases on the server. * * Requirements: * 1. Working FileMaker Server installation * 2. 'FMPHP_Sample' database hosted in FileMaker Server * */ // Include FileMaker API require_once 'FileMaker.php'; // Create a new connection to server without specifying database or hostspec. $fm = new FileMaker(); // Set 'hostspec' property using setProperty() $fm->setProperty('hostspec', 'http://localhost'); $databases = $fm->listDatabases(); // If an error is found, return a message and exit. if (FileMaker::isError($databases)) { printf("Error %s: %s\n", $databases->getCode()); "<br>"; printf($databases->getMessage()); exit; } // Print out layout names foreach ($databases as $db) { echo "{$db}<br>"; } ?> </body> </html>
/** * @covers \airmoi\FileMaker\FileMaker::listDatabases */ public function testListDatabases() { $databases = $this->fm->listDatabases(); $this->assertTrue(is_array($databases)); $this->assertTrue(in_array($GLOBALS['DB_FILE'], $databases, 'Database ' . $GLOBALS['DB_FILE'] . ' is missing. Test can\'t run')); }