Example #1
0
 public function case_event_is_sent()
 {
     $self = $this;
     $this->given(Event::getEvent('hoa://Event/Exception')->attach(function (Event\Bucket $bucket) use($self, &$called) {
         $called = true;
         $self->object($bucket->getSource())->isInstanceOf('Hoa\\Exception\\Exception')->string($bucket->getSource()->getMessage())->isEqualTo('foo')->object($bucket->getData())->isIdenticalTo($bucket->getSource());
     }))->when(new SUT('foo'))->then->boolean($called)->isTrue();
 }
Example #2
0
 public function case_send()
 {
     $self = $this;
     $this->given($eventId = 'hoa://Event/Test', $source = new \Mock\Hoa\Event\Source(), LUT::register($eventId, $source), $bucket = new SUT('foo'), LUT::getEvent($eventId)->attach(function (SUT $receivedBucket) use($self, $bucket, &$called) {
         $called = true;
         $self->object($receivedBucket)->isIdenticalTo($bucket);
     }))->when($result = $bucket->send($eventId, $source))->then->variable($result)->isNull()->boolean($called)->isTrue();
 }
Example #3
0
 /**
  * Close the current stream.
  *
  * @return  void
  */
 public final function close()
 {
     $streamName = $this->getStreamName();
     $name = md5($streamName);
     if (!isset(self::$_register[$name])) {
         return;
     }
     Event::notify('hoa://Event/Stream/' . $streamName . ':close-before', $this, new Event\Bucket());
     if (false === $this->_close()) {
         return;
     }
     unset(self::$_register[$name]);
     $this->_bucket[self::HANDLER] = null;
     Event::unregister('hoa://Event/Stream/' . $streamName);
     Event::unregister('hoa://Event/Stream/' . $streamName . ':close-before');
     return;
 }
Example #4
0
File: Xyl.php Project: Jir4/Xyl
        throw new Exception('Selector %s is not a valid selector.', 22, $selector);
    }
    /**
     * Destruct XYL object.
     *
     * @return  void
     */
    public function __destruct()
    {
        $protocol = Protocol::getInstance();
        unset($protocol['Library']['Xyl[' . $this->_i . ']']);
        return;
    }
}
/**
 * Class \Hoa\Xyl\_Protocol.
 *
 * The `hoa://Library/Xyl` node.
 *
 * @copyright  Copyright © 2007-2016 Hoa community
 * @license    New BSD License
 */
class _Protocol extends Protocol\Node
{
}
/**
 * Flex entity.
 */
Consistency::flexEntity('Hoa\\Xyl\\Xyl');
Event::getEvent('hoa://Event/Exception')->attach(xcallable('Hoa\\Xyl\\Interpreter\\Common\\Debug', 'receiveException'));
Example #5
0
 /**
  * Send the exception on hoa://Event/Exception.
  *
  * @return  void
  */
 public function send()
 {
     Event::notify('hoa://Event/Exception', $this, new Event\Bucket($this));
     return;
 }