public function __construct() { $this->_url = Junction::getCurrentUrl(); $this->_time = microtime(true); }
public function __construct(array $expressions) { parent::__construct(Junction::DISJUNCTION, $expressions); }
/** * Test using sendMessage on an OUTPUT pipe. * <P> * Creates a Pipe, Junction and Message. * Adds the PipeListener to the Pipe. * Adds the Pipe to the Junction as an OUTPUT pipe. * uses the Junction's sendMessage method to send * the Message, then checks that it was received.</P> */ public function testSendMessageOnAnOutputPipe() { // create pipe $pipe = new Pipe(); // add a PipeListener manually $listenerAdded = $pipe->connect(new PipeListener($this, 'callBackMethod')); // create junction $junction = new Junction(); // create test message $message = new Message(Message::NORMAL, array('testVal' => 1)); // register the pipe with the junction, giving it a name and direction $registered = $junction->registerPipe('testOutputPipe', Junction::OUTPUT, $pipe); // send the message using the Junction's method // it should show up in messageReceived property via the pipeListener $sent = $junction->sendMessage('testOutputPipe', $message); // test assertions $this->assertTrue($pipe instanceof Pipe, "Expecting \$pipe instanceof Pipe"); $this->assertTrue($junction instanceof Junction, "Expecting \$junction instanceof Junction"); $this->assertTrue($registered, "Expecting regsitered pipe"); $this->assertTrue($listenerAdded, "Expecting added pipeListener"); $this->assertTrue($sent, "Expecting successful write to pipe"); $this->assertTrue(count($this->messagesReceived) == 1, "Expecting received 1 messages"); $this->assertTrue(array_pop($this->messagesReceived) === $message, "Expecting received message was same instance sent"); //object equality }
/** * Links this filter with a logical AND to the specified filter * @param Filter $f the filter to logically link to this filter * @return Junction the resulting junction */ public function and_(Filter $f) { $junction = new Junction(Junction::TypeAnd); return $junction->add($this)->add($f); }