Completed
Push — master ( 675c2f...342161 )
by Guillem
01:39
created

RequestParameterTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A itCanBeSerialized() 0 7 1
A itThrowAnExceptionOnUnsupportedParameterLocation() 0 9 1
1
<?php
2
namespace ElevenLabs\Api\Definition;
3
4
use PHPUnit\Framework\TestCase;
5
6
class RequestParameterTest extends TestCase
7
{
8
    /** @test */
9
    public function itThrowAnExceptionOnUnsupportedParameterLocation()
10
    {
11
        $this->expectException(\InvalidArgumentException::class);
12
        $this->expectExceptionMessage(
13
            'nowhere is not a supported parameter location, ' .
14
            'supported: path, header, query, body, formData'
15
        );
16
17
        $param = new Parameter('nowhere', 'foo');
0 ignored issues
show
Unused Code introduced by
The assignment to $param is dead and can be removed.
Loading history...
18
    }
19
20
    /** @test */
21
    public function itCanBeSerialized()
22
    {
23
        $requestParameter = new Parameter('query', 'foo', true, new \stdClass());
24
        $serialized = serialize($requestParameter);
25
26
        assertThat(unserialize($serialized), self::equalTo($requestParameter));
27
        self::assertTrue($requestParameter->hasSchema());
28
    }
29
}
30