function testOutputOfHttpVersion() { $this->given($version = new mockOfHttp\version(), $output = new mockOfOutput(), $defaultMajorVersion = new output\stream(uniqid()), $defaultFormater = new mockOfOutput\stream\formater(), $this->calling($defaultFormater)->outputIs = function ($output) use($defaultMajorVersion) { $output->outputStreamIs($defaultMajorVersion); })->if($this->newTestedInstance($defaultFormater))->then->object($this->testedInstance->outputOfHttpVersionIs($version, $output))->isTestedInstance->mock($output)->receive('outputStreamIs')->withArguments($defaultMajorVersion)->once->given($majorVersion = new mockOfHttp\version\major(), $this->calling($majorVersion)->__toString = uniqid(), $this->calling($version)->recipientOfHttpMajorVersionIs = function ($recipient) use($majorVersion) { $recipient->httpMajorVersionIs($majorVersion); })->if($this->testedInstance->outputOfHttpVersionIs($version, $output))->mock($output)->receive('outputStreamIs')->withArguments(new output\stream($majorVersion))->once; }
function testOutputOfHttpHeaderIs() { $this->given($output = new mockOfOutput(), $header = new mockOfHttp\header(), $defaultValue = new output\stream(uniqid()), $defaultValueFormater = new mockOfOutput\stream\formater(), $this->calling($defaultValueFormater)->outputIs = function ($output) use($defaultValue) { $output->outputStreamIs($defaultValue); })->if($this->newTestedInstance($defaultValueFormater))->then->object($this->testedInstance->outputOfHttpHeaderIs($header, $output))->isTestedInstance->mock($output)->receive('outputStreamIs')->withIdenticalArguments($defaultValue)->once->given($value = new mockOfHttp\header\value(), $this->calling($value)->__toString = uniqid(), $this->calling($header)->recipientOfHttpHeaderValueIs = function ($recipient) use($value) { $recipient->httpHeaderValueIs($value); })->if($this->testedInstance->outputOfHttpHeaderIs($header, $output))->then->mock($output)->receive('outputStreamIs')->withIdenticalArguments($defaultValue)->once->withArguments(new output\stream($value))->once; }