Exemplo n.º 1
0
Arquivo: Time.php Projeto: vimac/zan
 public function tick()
 {
     $this->getCurrentTimeStamp();
     Event::fire('clock_tick');
 }
Exemplo n.º 2
0
 public function testChainWorkFine()
 {
     $that = $this;
     $chain1 = function ($args) use($that) {
         $that->chain1Test();
     };
     $chain2 = function ($args) use($that) {
         $that->chain2Test();
     };
     $chain3 = function ($args) use($that) {
         $that->chain3Test();
     };
     $chain4 = function ($args) use($that) {
         $that->chain4Test();
     };
     Event::bind('chain1', $chain1);
     Event::bind('chain2', $chain2);
     Event::bind('chain3', $chain3);
     Event::bind('chain4', $chain4);
     EventChain::join('chain1', 'chain2', 'chain3', 'chain4');
     Event::fire('chain1');
     $this->assertArrayHasKey('chain1', $this->dataMap, 'event chain1 fail');
     $that->assertEquals('ok', $this->dataMap['chain1'], 'event chain1 fail');
     $this->assertArrayHasKey('chain2', $this->dataMap, 'event chain2 fail');
     $that->assertEquals('ok', $this->dataMap['chain2'], 'event chain2 fail');
     $this->assertArrayHasKey('chain3', $this->dataMap, 'event chain3 fail');
     $that->assertEquals('ok', $this->dataMap['chain3'], 'event chain3 fail');
     $this->assertArrayHasKey('chain4', $this->dataMap, 'event chain4 fail');
     $that->assertEquals('ok', $this->dataMap['chain4'], 'event chain4 fail');
 }