* 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 FMPHP_Sample database. // Location of FileMaker Server is assumed to be on the same machine, // thus we assume hostspec is api default of 'http://localhost' as specified // in filemaker-api.php. // If FMSA web server is on another machine, specify 'hostspec' as follows: // $fm = new FileMaker('FMPHP_Sample', 'http://10.0.0.1'); $fm = new FileMaker('FMPHP_Sample'); // Call listLayouts() to get array of layout names. $layouts = $fm->listLayouts(); // If an error is found, return a message and exit. if (FileMaker::isError($layouts)) { printf("Error %s: %s\n", $layouts->getCode()); "<br>"; printf($layouts->getMessage()); exit; } // Print out layout names foreach ($layouts as $layout) { echo $layout . "<br>"; } ?> </body> </html>
/** * @covers \airmoi\FileMaker\FileMaker::listLayouts */ public function testListLayouts() { $layouts = $this->fm->listLayouts(); $this->assertTrue(in_array('sample', $layouts)); }