Passed
Push — master ( 487089...443b76 )
by Chris
03:30
created

SetPowerTest::testWireSizeProperty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace DaveRandom\LibLifxLan\Tests\Messages\Device\Commands;
4
5
use DaveRandom\LibLifxLan\Messages\Device\Commands\SetPower;
6
use PHPUnit\Framework\TestCase;
7
8
final class SetPowerTest extends TestCase
9
{
10
    public function testLevelPropertyValidValues(): void
11
    {
12
        foreach ([0, 42, 65535] as $level) {
13
            $this->assertSame((new SetPower($level))->getLevel(), $level);
14
        }
15
    }
16
17
    /**
18
     * @expectedException \DaveRandom\LibLifxLan\Exceptions\InvalidValueException
19
     */
20
    public function testLevelPropertyValueTooLow(): void
21
    {
22
        new SetPower(-1);
23
    }
24
25
    /**
26
     * @expectedException \DaveRandom\LibLifxLan\Exceptions\InvalidValueException
27
     */
28
    public function testLevelPropertyValueTooHigh(): void
29
    {
30
        new SetPower(65536);
31
    }
32
33
    public function testTypeIdProperty(): void
34
    {
35
        $this->assertSame((new SetPower(0))->getTypeId(), SetPower::MESSAGE_TYPE_ID);
36
    }
37
38
    public function testWireSizeProperty(): void
39
    {
40
        $this->assertSame((new SetPower(0))->getWireSize(), SetPower::WIRE_SIZE);
41
    }
42
}
43