/** * @param \Emris\Cli\Scaler\Domain\Server $server * @return bool * @throws \RuntimeException */ public function delServer(Server $server) { $url = $this->base . '/upstream_conf?remove=&upstream=' . $this->upstream . '&id=' . $server->getId(); $contents = $this->_call($url); /** @noinspection IsEmptyFunctionUsageInspection */ if (empty($contents)) { return false; } return true; }
*/ use Emris\Cli\Scaler\Domain\Server; describe('Emris\\Cli\\Scaler\\Domain\\Server', function () { beforeEach(function () { $this->faker = Faker\Factory::create(); }); describe('->__construct()', function () { it('should return a Server object', function () { $server = new Server($this->faker->randomNumber(4), $this->faker->localIpv4, $this->faker->numberBetween(1000, 9000)); expect($server)->to->be->instanceof('Emris\\Cli\\Scaler\\Domain\\Server'); }); }); describe('->getIp()', function () { it('should return the correct IP', function () { $id = $this->faker->randomNumber(4); $ip = $this->faker->localIpv4(); $port = $this->faker->numberBetween(1000, 9000); $server = new Server($id, $ip, $port); expect($server->getIp())->to->equal($ip); }); }); describe('->getIp()', function () { it('should return the correct PORT number', function () { $id = $this->faker->randomNumber(4); $ip = $this->faker->localIpv4(); $port = $this->faker->numberBetween(1000, 9000); $server = new Server($id, $ip, $port); expect($server->getPort())->to->equal($port); }); }); });
/** * @param \Emris\Cli\Scaler\Domain\Server $server * @return mixed */ public function buildFrom(Server $server) { $this->setId($server->getId()); $this->setName($server->getName()); return $this->build(); }