<commit_before><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace ZendTest\Http\Response;

use Zend\Http\Response\Stream;

class ResponseStreamTest extends \PHPUnit_Framework_TestCase
{

    public function testResponseFactoryFromStringCreatesValidResponse()
    {
        $string = 'HTTP/1.0 200 OK' . "\r\n\r\n".'Foo Bar'."\r\n";
        $stream = fopen('php://temp','rb+');
        fwrite($stream, 'Bar Foo');
        rewind($stream);

        $response = Stream::fromStream($string, $stream);
        $this->assertEquals(200, $response->getStatusCode());
        $this->assertEquals("Foo Bar\r\nBar Foo", $response->getBody());
    }

    public function testResponseFactoryFromEmptyStringCreatesValidResponse()
    {
        $stream = fopen('php://temp','rb+');
        fwrite($stream, 'HTTP/1.0 200 OK' . "\r\n\r\n".'Foo Bar'."\r\n".'Bar Foo');
        rewind($stream);

        $response = Stream::fromStream('', $stream);
        $this->assertEquals(200, $response->getStatusCode());<commit_msg>Adding `@group` and `@covers` annotations to stream response test for #6027<commit_after><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace ZendTest\Http\Response;

use Zend\Http\Response\Stream;

class ResponseStreamTest extends \PHPUnit_Framework_TestCase
{

    public function testResponseFactoryFromStringCreatesValidResponse()
    {
        $string = 'HTTP/1.0 200 OK' . "\r\n\r\n".'Foo Bar'."\r\n";
        $stream = fopen('php://temp','rb+');
        fwrite($stream, 'Bar Foo');
        rewind($stream);

        $response = Stream::fromStream($string, $stream);
        $this->assertEquals(200, $response->getStatusCode());
        $this->assertEquals("Foo Bar\r\nBar Foo", $response->getBody());
    }

    /**
     * @group 6027
     *
     * @covers \Zend\Http\Response\Stream::fromStream
     */
    public function testResponseFactoryFromEmptyStringCreatesValidResponse()
    {
        $stream = fopen('php://temp','rb+');
        fwrite($stream, 'HTTP/1.0 200 OK' . "\r\n\r\n".'Foo Bar'."\r\n".'Bar Foo');
        rewind($stream);

        $response = Stream::fromStream('', $stream);
        $this->assertEquals(200, $response->getStatusCode());
{'fraction_non_alphanumeric': 0.17135455218356774, 'fraction_numerical': 0.02146558105107328, 'mean_word_length': 3.2366771159874608, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3429592', 'n_tokens_mistral': 899, 'n_tokens_neox': 821, 'n_words': 163}