WithBodyStreamTraitTest::testBody()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 15
Ratio 100 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
c 3
b 1
f 1
dl 15
loc 15
rs 9.4286
cc 1
eloc 10
nc 1
nop 1
1
<?php
2
/**
3
 * This file is part of the beebot package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 *
7
 * @copyright Bee4 2015
8
 * @author    Stephane HULARD <[email protected]>
9
 * @package   Bee4\Test\Transport\Message
10
 */
11
12
namespace Bee4\Test\Transport\Message;
13
14
/**
15
 * WithBodyStreamTrait unit test definition
16
 * @package Bee4\Test\Transport\Message
17
 */
18 View Code Duplication
class WithBodyStreamTraitTest extends WithBodyTraitTest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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