Beispiel #1
0
 /**
  * @covers Soliant\SimpleFM\Adapter::setHostParams
  */
 public function testSetHostParams()
 {
     $params = array('hostname' => '127.0.0.1', 'dbname' => 'testdb', 'username' => 'root', 'password' => 'soliant');
     $value = $this->object->setHostParams($params);
     $this->assertTrue($value instanceof $this->object);
     $this->assertEquals($this->object->getHostname(), '127.0.0.1');
     $this->assertEquals($this->object->getDbname(), 'testdb');
     $this->assertEquals($this->object->getUsername(), 'root');
     $this->assertEquals($this->object->getPort(), '80');
     $this->assertEquals($this->object->getProtocol(), 'http');
     $params = array('port' => '9000', 'protocol' => 'https');
     $value = $this->object->setHostParams($params);
     $this->assertEquals($this->object->getPort(), '9000');
     $this->assertEquals($this->object->getProtocol(), 'https');
     $params = array('protocol' => 'xyz');
     $this->setExpectedException('InvalidArgumentException');
     $value = $this->object->setHostParams($params);
 }
Beispiel #2
0
require_once '../library/Soliant/SimpleFM/Loader/FilePostContents.php';
use Soliant\SimpleFM\Adapter;
/**
 * The hostname can either be an IP address or any valid network name you have configured and hosting the
 * FileMaker XML API. FMServer_Sample.fmp12 is included with FileMaker Server 12; the default username is
 * Admin with blank password. You should always leave off the file extension when configuring dbname.
 */
$hostParams = array('hostname' => 'localhost', 'dbname' => 'FMServer_Sample', 'username' => 'Admin', 'password' => '');
/**
 * Initialize the adapter with the hostParams array for your environment.
 */
$adapter = new Adapter($hostParams);
/**
 * At runtime, you can update hostParams on an adapter that has already been instantiated.
 */
$adapter->setHostParams(array('hostname' => 'localhost', 'dbname' => 'FMServer_Sample', 'username' => 'someusername', 'password' => 'somepassword'));
/**
 * After you have initialized a SimpleFMAdapter with valid credentials, there are a number of ways to make calls with it.
 * The simplest is to setCallParams with a layoutname and a commandstring. The commandstring follows the XML RPC
 * syntax for FileMaker Server 12. See /documentation/fms12_cwp_xml_en.pdf, Appendix A on page 43 for details.
 */
$adapter->setCallParams(array('layoutname' => 'Tasks', 'commandstring' => '-max=10&-skip=5&-findall'));
/**
 * You may also update an adapter's credentials at runtime, either by setCredentials with a new array
 */
$adapter->setCredentials(array('username' => 'someotherusername', 'password' => 'someotherpassword'));
/**
 * ...or with the setUsername and setPassword methods.
 */
$adapter->setUsername('Admin');
$adapter->setPassword('');