示例#1
0
 /**
  * @covers \airmoi\FileMaker\FileMaker::newPerformScriptCommand
  * @depends testNewAddCommand
  */
 public function testNewPerformScriptCommand()
 {
     $command = $this->fm->newPerformScriptCommand('sample', 'cleanup db');
     if (!$GLOBALS['OFFICIAL_API']) {
         $this->assertInstanceOf(Command\PerformScript::class, $command);
     } else {
         $this->assertInstanceOf(\FileMaker_Command_PerformScript::class, $command);
     }
     $result = $command->execute();
     if (!$GLOBALS['OFFICIAL_API']) {
         $this->assertInstanceOf(Object\Result::class, $result);
     } else {
         $this->assertInstanceOf(\FileMaker_Result::class, $result);
     }
     $this->assertEquals(0, (int) $result->getFoundSetCount());
     $command = $this->fm->newPerformScriptCommand('sample', 'create sample data', 50);
     if (!$GLOBALS['OFFICIAL_API']) {
         $command->setRange(5, 25);
         $result = $command->execute();
         $this->assertInstanceOf(Object\Result::class, $result);
         $this->assertEquals(50, (int) $result->getFoundSetCount());
         $this->assertEquals(25, (int) $result->getFetchCount());
         $this->assertRegExp('#(http:\\/\\/|https:\\/\\/)?[^:\\/]*(:\\d{2})?\\/fmi\\/xml\\/fmresultset\\.xml\\?-db=[^\\&]*\\&-lay=[^\\&]*\\&-script=[^\\&]*\\&-script.param=[^\\&]*\\&-findany#', $this->fm->lastRequestedUrl);
     } else {
         $result = $command->execute();
     }
 }