public function setStatus($status) { $httpStatus = \Bitrix\Main\Config\Configuration::getValue("http_status"); $bCgi = stristr(php_sapi_name(), "cgi") !== false; if ($bCgi && ($httpStatus == null || $httpStatus == false)) { header("Status: " . $status); } else { $server = $this->context->getServer(); header($server->get("SERVER_PROTOCOL") . " " . $status); } }
public function testContext() { $server = $this->getMockBuilder('Deployer\\Server\\ServerInterface')->disableOriginalConstructor()->getMock(); $env = $this->getMockBuilder('Deployer\\Server\\Environment')->disableOriginalConstructor()->getMock(); $input = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputInterface')->disableOriginalConstructor()->getMock(); $output = $this->getMockBuilder('Symfony\\Component\\Console\\Output\\OutputInterface')->disableOriginalConstructor()->getMock(); $context = new Context($server, $env, $input, $output); $this->assertInstanceOf('Deployer\\Server\\ServerInterface', $context->getServer()); $this->assertInstanceOf('Deployer\\Server\\Environment', $context->getEnvironment()); $this->assertInstanceOf('Symfony\\Component\\Console\\Input\\InputInterface', $context->getInput()); $this->assertInstanceOf('Symfony\\Component\\Console\\Output\\OutputInterface', $context->getOutput()); Context::push($context); $this->assertEquals($context, Context::get()); $this->assertEquals($context, Context::pop()); }