public function case_register() { $this->given($oldGet = SUT::get(), $transport = 'foo' . uniqid(), $oldExists = SUT::exists($transport))->when($result = SUT::register($transport, function () { }))->then->variable($result)->isNull()->boolean($oldExists)->isFalse()->boolean(SUT::exists($transport))->isTrue()->integer(count(SUT::get()))->isEqualTo(count($oldGet) + 1); }
/** * Set the transport. * * @param string $transport Transport (TCP, UDP etc.). * @return string * @throws \Hoa\Socket\Exception */ protected function setTransport($transport) { $transport = strtolower($transport); if (false === Transport::exists($transport)) { throw new Exception('Transport %s is not enabled on this machin.', 3, $transport); } $old = $this->_transport; $this->_transport = $transport; return $old; }