/** * ²âÊÔ stop_queue½Ó¿Ú */ public function testStopQueue() { // ²âÊÔ1 queue param´íÎó $states = null; $name = 'queue'; $token = 'token'; $this->assertFalse(BigpipeQueueAdministrationTools::stop_queue($name, null, $this->meta_conf, $states)); // ²âÊÔ2 _init_meta´íÎó BigpipeQueueAdministrationTools::$stub_meta = false; $this->assertFalse(BigpipeQueueAdministrationTools::stop_queue($name, $token, $this->meta_conf, $states)); // ¶¨Òåstub_metaÐÐΪ $this->stub_meta->expects($this->any())->method('update_entry')->will($this->onConsecutiveCalls(false, true)); $queue_deleted = array('token' => 'token', 'status' => BigpipeQueueStatus::DELETED); $queue_normal = array('token' => 'token', 'status' => BigpipeQueueStatus::CREATED); $queue_unauthor = array('token' => 'mistoken', 'status' => BigpipeQueueStatus::CREATED); $this->stub_meta->expects($this->any())->method('get_entry')->will($this->onConsecutiveCalls(false, $queue_unauthor, $queue_deleted, $queue_normal, $queue_normal)); // ²âÊÔ3 get entry´íÎó BigpipeQueueAdministrationTools::$stub_meta = $this->stub_meta; $this->assertFalse(BigpipeQueueAdministrationTools::stop_queue($name, $token, $this->meta_conf, $states)); // ²âÊÔ4 token´íÎó $this->assertFalse(BigpipeQueueAdministrationTools::stop_queue($name, $token, $this->meta_conf, $states)); // ²âÊÔ5 queueÊÇÒÑɾ³ý״̬ $this->assertTrue(BigpipeQueueAdministrationTools::stop_queue($name, $token, $this->meta_conf, $states)); // ²âÊÔ6 update entryʧ°Ü $this->assertFalse(BigpipeQueueAdministrationTools::stop_queue($name, $token, $this->meta_conf, $states)); // ²âÊÔ7 ³É¹¦Á÷³Ì $this->assertTrue(BigpipeQueueAdministrationTools::stop_queue($name, $token, $this->meta_conf, $states)); }
// 订阅参数 $conf_dir = './conf'; $conf_file = 'util_1.conf'; $name = 'autopush_t1'; $token = 'token'; $args = $_SERVER['argv']; $prog_name = array_shift($args); if (4 == count($args)) { // 读取命令行参数 $conf_dir = $args[0]; $conf_file = $args[1]; $name = $args[2]; $token = $args[3]; } $conf_content = config_load($conf_dir, $conf_file); if (false === $conf_content) { echo config_error_message(); die; } $stat = null; $ret = BigpipeQueueAdministrationTools::stop_queue($name, $token, $conf_content['meta'], $stat); if (false === $ret) { echo "afwul stop queue\n"; } else { print_r($stat); echo "\n queue stopped \n"; } BigpipeLog::close(); ?>