Code Duplication    Length = 19-21 lines in 2 locations

test/units/Transport/Message/WithBodyStreamTraitTest.php 1 location

@@ 18-38 (lines=21) @@
15
 * WithBodyStreamTrait unit test definition
16
 * @package Bee4\Test\Transport\Message
17
 */
18
class WithBodyStreamTraitTest extends WithBodyTraitTest
19
{
20
    /**
21
     * Test all headers collection manipulation function
22
     */
23
    public function testBody($mock = null)
24
    {
25
        $mock = $this->getObjectForTrait(
26
            'Bee4\Transport\Message\WithBodyStreamTrait'
27
        );
28
        parent::testBody($mock);
29
30
        $stream = tmpfile();
31
        fwrite($stream, 'toto');
32
        $mock->setBody($stream);
33
34
        $this->assertEquals($stream, $mock->getBody());
35
        $this->assertTrue($mock->hasBodyStream());
36
        $this->assertEquals(4, $mock->getBodyLength());
37
    }
38
}
39

test/units/Transport/Message/WithBodyTraitTest.php 1 location

@@ 18-36 (lines=19) @@
15
 * WithBodyTrait unit test definition
16
 * @package Bee4\Test\Transport\Message
17
 */
18
class WithBodyTraitTest extends \PHPUnit_Framework_TestCase
19
{
20
    /**
21
     * Test all headers collection manipulation function
22
     */
23
    public function testBody($mock = null)
24
    {
25
        if (null === $mock) {
26
            $mock = $this->getObjectForTrait('Bee4\Transport\Message\WithBodyTrait');
27
        }
28
29
        $body = 'Just a sample body';
30
31
        $this->assertFalse($mock->getBody());
32
        $mock->setBody($body);
33
        $this->assertEquals($body, $mock->getBody());
34
        $this->assertEquals(strlen($body), $mock->getBodyLength());
35
    }
36
}
37