Esempio n. 1
0
 /**
  * @covers Soliant\SimpleFM\Adapter::execute
  * @todo Write more assertions for testExecute which exercise un-covered parser edge cases
  */
 public function testExecute()
 {
     $file = dirname(__FILE__) . '/TestAssets/projectsampledata.xml';
     $mockLoader = $this->object->getLoader();
     $mockLoader->setTestXml(file_get_contents($file));
     // return three records
     $result = $this->object->execute();
     $this->assertEquals($result['count'], 3);
     // parsed with rowsbyrecid TRUE
     $this->object->setRowsbyrecid(TRUE);
     $result = $this->object->execute();
     $taskNameField = $result['rows'][7676]['Tasks']['rows'][15001]['Task Name'];
     $this->assertEquals($taskNameField, 'Review mock ups');
     // parsed with rowsbyrecid FALSE (the default behavior)
     $this->object->setRowsbyrecid(FALSE);
     $result = $this->object->execute();
     $nonRepeatingField = $result['rows'][0]['Status'];
     $this->assertEquals($nonRepeatingField, '4');
     $this->assertInternalType('string', $nonRepeatingField);
     $this->assertNotInternalType('array', $nonRepeatingField);
     $repeatingField = $result['rows'][0]['Repeating Field'];
     $this->assertInternalType('array', $repeatingField);
     $this->assertNotInternalType('string', $repeatingField);
     $taskNameField = $result['rows'][1]['Tasks']['rows'][2]['Task Name'];
     $this->assertEquals($taskNameField, 'Complete sketches');
     $this->assertInternalType('string', $taskNameField);
     $this->assertNotInternalType('array', $taskNameField);
     $taskRepeatingField = $result['rows'][1]['Tasks']['rows'][2]['Repeating Field'];
     $this->assertInternalType('array', $taskRepeatingField);
     $this->assertNotInternalType('string', $taskRepeatingField);
 }
Esempio n. 2
0
 public function delete(AbstractEntity $entity)
 {
     $commandArray = array('-recid' => $entity->getRecid(), '-modid' => $entity->getModid(), '-delete' => NULL);
     $this->simpleFMAdapter->setCommandArray($commandArray)->setLayoutname($this->getEntityLayout());
     $result = $this->handleAdapterResult($this->simpleFMAdapter->execute());
     return true;
 }
Esempio n. 3
0
   echo '<pre>';
   var_dump($commandarray);
   echo($commandstring);
   die();

*
*/
/**
 * SimpleFMAdapter also provides a Boolean rowsbyrecid property which makes the returned rows of data associative
 * by FileMaker recid instead of the default behavior which is rows as an arbitrarily indexed array.
 */
$adapter->setRowsbyrecid(FALSE);
/**
 * Once your adapter is ready, use execute to make the host request.
 */
$result = $adapter->execute();
/**
 * These are the elements simpleFM returns in the result array.
 */
$url = $result['url'];
// string
$error = $result['error'];
// int
$errortext = $result['errortext'];
// string
$errortype = $result['errortype'];
// string
$count = $result['count'];
// int
$fetchsize = $result['fetchsize'];
// int