public function testExecute()
 {
     // Assert
     $callback = $this->getMock(NodeInterface::class);
     $callback->expects($this->once())->method('execute');
     // Arrange
     $variableResource = new ResourceVariable();
     $variableResource->setValue(tmpfile());
     $variableData = new StringVariable();
     $variableData->setValue('test');
     $action = new StreamWriteAction();
     $action->bind(StreamWriteAction::SOCKET_STREAM, $variableResource);
     $action->bind(StreamWriteAction::SOCKET_DATA, $variableData);
     $action->bind(StreamWriteAction::SOCKET_OUTPUT, $callback);
     // Act
     $action->execute();
 }
 public function testExecute()
 {
     // Assert
     $callback = $this->getMockForAbstractClass(NodeInterface::class);
     $callback->expects($this->once())->method('execute');
     // Arrange
     $variableFile = new StringVariable();
     $variableFile->setValue(tempnam(sys_get_temp_dir(), 'test'));
     $variableMode = new StringVariable();
     $variableMode->setValue('w');
     $variableStream = new ResourceVariable();
     $action = new StreamOpenAction();
     $action->bind(StreamOpenAction::SOCKET_FILENAME, $variableFile);
     $action->bind(StreamOpenAction::SOCKET_MODE, $variableMode);
     $action->bind(StreamOpenAction::SOCKET_STREAM, $variableStream);
     $action->bind(StreamOpenAction::SOCKET_OUTPUT, $callback);
     // Act
     $action->execute();
     // Assert
     $this->assertInternalType('resource', $variableStream->getValue());
 }
<?php

/**
 * NextFlow (http://github.com/nextflow)
 *
 * @link http://github.com/nextflow/nextflow-php for the canonical source repository
 * @copyright Copyright (c) 2014-2016 NextFlow (http://github.com/nextflow)
 * @license https://raw.github.com/nextflow/nextflow-php/master/LICENSE MIT
 */
use NextFlow\Core\Event\NamedEvent;
use NextFlow\Core\Scene\Scene;
use NextFlow\Php\Action\EchoAction;
use NextFlow\Php\Variable\StringVariable;
require __DIR__ . '/../vendor/autoload.php';
$variable = new StringVariable();
$variable->setValue('Hello world');
$action = new EchoAction();
$action->bind(EchoAction::SOCKET_DATA, $variable);
$event = new NamedEvent('demo');
$event->bind(NamedEvent::SOCKET_OUT, $action);
$scene = new Scene();
$scene->addEvent($event);
$scene->execute('demo');
 public function testExecute()
 {
     $variable = new StringVariable();
     $variable->execute();
 }
 private function createStringVariable($value)
 {
     $variable = new StringVariable();
     $variable->setValue($value);
     return $variable;
 }