Esempio n. 1
0
     echo 'Test EMPTY validation <span style="color:red">FAIL</span>' . PHP_EOL . PHP_EOL;
 } catch (FileMakerValidationException $ex) {
     echo 'Test EMPTY validation <span style="color:green">SUCCESS</span>' . PHP_EOL . PHP_EOL;
 }
 echo 'Test Max Length validation (' . $field->maxCharacters . ')... ';
 try {
     $field->validate(str_repeat('a', 51));
     echo '<span style="color:red">FAIL</span>' . PHP_EOL . PHP_EOL;
 } catch (FileMakerValidationException $ex) {
     echo '<span style="color:green">SUCCESS</span> ' . PHP_EOL . PHP_EOL;
 }
 echo "------------------------------------------" . PHP_EOL;
 echo " Test Find object's main methods" . PHP_EOL;
 echo "------------------------------------------" . PHP_EOL;
 echo 'Test FindAll command... ';
 $find = $fm->newFindAllCommand($layout->getName());
 $result = $find->execute();
 echo 'Found ' . $result->getFetchCount() . ' Expected 100...' . ($result->getFetchCount() == 100 ? '<span style="color:green">SUCCESS</span>' : '<span style="color:red">FAIL</span>') . PHP_EOL . PHP_EOL;
 echo 'Test FindAny command... ';
 $find = $fm->newFindAnyCommand($layout->getName());
 $result = $find->execute();
 echo 'Found ' . $result->getFetchCount() . ' Expected 1...' . ($result->getFetchCount() == 1 ? '<span style="color:green">SUCCESS</span>' : '<span style="color:red">FAIL</span>') . PHP_EOL . PHP_EOL;
 echo 'Test creating Find object from FileMaker... ';
 $find = $fm->newFindCommand($layout->getName());
 echo '<span style="color:green">SUCCESS</span>' . PHP_EOL . PHP_EOL;
 echo 'Test adding preCommandScript... ';
 $find->setPreCommandScript('create sample data');
 echo '<span style="color:green">SUCCESS</span>' . PHP_EOL . PHP_EOL;
 echo 'Test adding find criterion... ';
 $find->addFindCriterion('id', 1);
 $find->addFindCriterion('text_field', '=="record #2"');