public function testStartStop() { $test = new Success(); $test->run($this->result); $this->assertEquals(1, $this->startCount); $this->assertEquals(1, $this->endCount); }
public function testSuccess() { $test = new Success(); $result = $test->run(); $this->assertEquals(0, $result->errorCount()); $this->assertEquals(0, $result->failureCount()); $this->assertEquals(1, count($result)); }
/** * @covers PHPUnit_Framework_TestResult */ public function testEndEventsAreCounted() { $this->result = new PHPUnit_Framework_TestResult(); $listener = new BaseTestListenerSample(); $this->result->addListener($listener); $test = new Success(); $test->run($this->result); $this->assertEquals(1, $listener->endCount); }
public function testSuccess() { $test = new Success(); $result = $test->run(); $this->assertEquals(PHPUnit_Runner_BaseTestRunner::STATUS_PASSED, $test->getStatus()); $this->assertEquals(0, $result->errorCount()); $this->assertEquals(0, $result->failureCount()); $this->assertEquals(0, $result->skippedCount()); $this->assertEquals(1, count($result)); }
public function testExecute() { $this->session->expects($this->once())->method('getLastOrderId')->willReturn(1); $this->session->expects($this->once())->method('setLastOrderId')->with(null); $title = $this->getMockBuilder(\Magento\Framework\View\Page\Title::class)->disableOriginalConstructor()->getMock(); $title->expects($this->once())->method('set')->with(__('Thank you for your payment!')); $config = $this->getMockBuilder(\Magento\Framework\View\Page\Config::class)->disableOriginalConstructor()->getMock(); $config->expects($this->once())->method('getTitle')->willReturn($title); $page = $this->getMockBuilder(\Magento\Framework\View\Result\Page::class)->disableOriginalConstructor()->getMock(); $page->expects($this->once())->method('getConfig')->willReturn($config); $this->resultPageFactory->expects($this->once())->method('create')->willReturn($page); $this->assertEquals($page, $this->controller->execute()); }
public function postLogin() { $email = Input::get('email'); $password = Input::get('password'); if (Auth::attempt(array('email' => $email, 'password' => $password))) { Success::flash('successMessage', 'Welcome to the blog, user!'); return Redirect::intended('/posts'); } else { // login failed, go back to the login screen Session::flash('error message', 'Login failed. Your username and/or password don\'t match.'); return Redirect::back()->withInput(); } }
public function toArray() { $r = new Success(); $r->set("limit", $this->limit); $r->set("records", $this->records); $r->set("total", $this->total); $r->set("start", $this->start); return $r->toArray(); }
function allyReComp(&$hako) { $rt1 = $this->allyDelete($hako); // 盟主不在により同盟データから削除 $rt2 = $this->allyMemberDel($hako); // 放棄、無人島を同盟データから削除 $rt3 = $this->allyPopComp($hako); // 人口の再集計(ターン処理に組み込んでいないため) if ($rt1 || $rt2 || $rt3) { // データ書き出し AllyUtil::allyOccupy($hako); AllyUtil::allySort($hako); $hako->writeAllyFile(); // メッセージ出力 Success::allyDataUp(); return 1; } return 0; }
public function update(Server $server) : Promise { switch ($this->state = $server->state()) { case Server::STARTING: $result = $this->application->onStart($this->proxy); if ($result instanceof \Generator) { return resolve($result); } break; case Server::STARTED: $f = (new \ReflectionClass($this))->getMethod("timeout")->getClosure($this); $this->timeoutWatcher = \Amp\repeat($f, 1000); break; case Server::STOPPING: $result = $this->application->onStop(); if ($result instanceof \Generator) { $promise = resolve($result); } elseif ($result instanceof Promise) { $promise = $result; } else { $promise = new Success(); } $promise->when(function () { $code = Code::GOING_AWAY; $reason = "Server shutting down!"; foreach ($this->clients as $client) { $this->close($client->id, $code, $reason); } }); \Amp\cancel($this->timeoutWatcher); $this->timeoutWatcher = null; return $promise; case Server::STOPPED: $promises = []; // we are not going to wait for a proper self::OP_CLOSE answer (because else we'd need to timeout for 3 seconds, not worth it), but we will ensure to at least *have written* it foreach ($this->clients as $client) { // only if we couldn't successfully send it in STOPPING $code = Code::GOING_AWAY; $reason = "Server shutting down!"; $result = $this->doClose($client, $code, $reason); if ($result instanceof \Generator) { $promise[] = resolve($result); } if (!empty($client->writeDeferredControlQueue)) { $promise = end($client->writeDeferredControlQueue)->promise(); if ($promise) { $promises[] = $promise; } } } $promise = any($promises); $promise->when(function () { foreach ($this->clients as $client) { $this->unloadClient($client); } }); return $promise; } return new Success(); }
function commandMain($hako, $data) { global $init; $id = $data['ISLANDID']; $num = $hako->idToNumber[$id]; $island = $hako->islands[$num]; $name = $island['name']; // パスワード if (!Util::checkPassword($island['password'], $data['PASSWORD'])) { // password間違い HakoError::wrongPassword(); return; } // モードで分岐 $command = $island['command']; $comary = explode(" ", $data['COMARY']); for ($i = 0; $i < $init->commandMax; $i++) { $pos = $i * 5; $kind = $comary[$pos]; $x = $comary[$pos + 1]; $y = $comary[$pos + 2]; $arg = $comary[$pos + 3]; $target = $comary[$pos + 4]; // コマンド登録 if ($kind == 0) { $kind = $init->comDoNothing; } $command[$i] = array('kind' => $kind, 'x' => $x, 'y' => $y, 'arg' => $arg, 'target' => $target); } Success::commandAdd(); // データの書き出し $island['command'] = $command; $hako->islands[$num] = $island; $hako->writeIslandsFile($island['id']); // owner modeへ $html = new HtmlMapJS(); $html->owner($hako, $data); }
/** * Construct regular expression result. * * @param array $matches * Matches as returned by {@see preg_matches}. * @param int[] $pos * Result position. * @param array $nextInput * Remaining input. * @param int[] $nextPos * Next position. */ public function __construct($matches, array $pos, array $nextInput, array $nextPos) { parent::__construct($matches[0][0], $pos, $nextInput, $nextPos); $this->matches = $matches; }