public function test_should_daemon_works_fine() { \Myfox\App\Worker\Test::$number = 0; $time1 = microtime(true); Daemon::run($this->inifile, array('script', 'test', '--sleep', 10, '--loop')); $this->assertEquals(true, abs(1000 * (microtime(true) - $time1) - 50) < 10); $this->assertEquals(5, \Myfox\App\Worker\Test::$number); }
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */ // +--------------------------------------------------------------------+ // | 调用入口 | // +--------------------------------------------------------------------+ // | Copyright (c) 2010 Taobao.com. All Rights Reserved | // +--------------------------------------------------------------------+ // | Author: pengchun <*****@*****.**> | // +--------------------------------------------------------------------+ // // $Id: run.php 48 2010-12-20 15:58:11Z pengchun $ require_once __DIR__ . '/../app/daemon.php'; \Myfox\App\Daemon::run(__DIR__ . '/../etc/myfox.ini', $_SERVER['argv']);
public function test_should_daemon_lock_works_fine() { Daemon::run(self::$inifile, array('script', 'test', '--locker', 'test loCkeR ', '--sleep=1')); Daemon::run(self::$inifile, array('script', 'test', '--locker', 'test locker', '--sleep=1')); }