Completed
Push — master ( 298f36...c6c82d )
by Mihail
06:19 queued 10s
created

ReadOnlyExceptionTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 1
1
<?php
2
3
namespace Koded\Stdlib;
4
5
use Koded\Exceptions\ReadOnlyException;
6
use Koded\Stdlib\Interfaces\Data;
7
use PHPUnit\Framework\TestCase;
8
9
class ReadOnlyExceptionTest extends TestCase
10
{
11
12
    public function test_message_and_code()
13
    {
14
        $ex1 = ReadOnlyException::forCloning('Foo');
15
        $ex2 = ReadOnlyException::forInstance('foo', 'Bar');
16
17
        $this->assertEquals('Cloning the Foo instance is not allowed', $ex1->getMessage());
18
        $this->assertSame(Data::E_CLONING_DISALLOWED, $ex1->getCode());
19
20
        $this->assertEquals('Cannot set foo. Bar instance is read-only', $ex2->getMessage());
21
        $this->assertSame(Data::E_READONLY_INSTANCE, $ex2->getCode());
22
    }
23
}
24