DataSift\Storyplayer\PlayerLib\Story::hasDeviceTeardown PHP Method

hasDeviceTeardown() public method

do we have a device teardown callback?
public hasDeviceTeardown ( ) : boolean
return boolean true if there is a device teardown callback
    public function hasDeviceTeardown()
    {
        return count($this->deviceTeardownCallback) > 0;
    }

Usage Example

Beispiel #1
0
 /**
  * @return void
  */
 public function stopDevice()
 {
     // get the browser adapter
     $adapter = $this->getDeviceAdapter();
     // stop the web browser
     if (!$adapter) {
         // nothing to do
         return;
     }
     // what are we doing?
     $log = $this->startAction('stop the test device');
     // do we have a deviceTeardown() phase?
     //
     // we need to run this BEFORE we stop the device, otherwise
     // the deviceTeardown() phase has no device to work with
     if (isset($this->story) && $this->story->hasDeviceTeardown()) {
         // get the callbacks to call
         $callbacks = $this->story->getDeviceTeardown();
         // make the call
         //
         // we do not need to wrap these in a TRY/CATCH block,
         // as we are already running inside one of the story's
         // phases
         foreach ($callbacks as $callback) {
             call_user_func($callback, $this);
         }
     }
     // stop the browser
     $adapter->stop();
     // destroy the adapter
     $this->setDeviceAdapter(null);
     // all done
     $log->endAction();
 }