File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace IlicMiljan \SecureProps \Tests \Reader \Exception ;
4+
5+ use IlicMiljan \SecureProps \Reader \Exception \ObjectPropertyNotFound ;
6+ use IlicMiljan \SecureProps \Reader \Exception \ReaderException ;
7+ use PHPUnit \Framework \TestCase ;
8+ use RuntimeException ;
9+
10+ class ObjectPropertyNotFoundTest extends TestCase
11+ {
12+ private string $ className ;
13+
14+ protected function setUp (): void
15+ {
16+ $ this ->className = 'TestClass ' ;
17+ }
18+
19+ public function testCanBeCreated (): void
20+ {
21+ $ exception = new ObjectPropertyNotFound ($ this ->className );
22+
23+ $ this ->assertInstanceOf (ObjectPropertyNotFound::class, $ exception );
24+ }
25+
26+ public function testReturnsClassName (): void
27+ {
28+ $ exception = new ObjectPropertyNotFound ($ this ->className );
29+
30+ $ this ->assertEquals ($ this ->className , $ exception ->getClassName ());
31+ }
32+
33+ public function testPreviousExceptionIsStored (): void
34+ {
35+ $ previous = new RuntimeException ('Previous exception ' );
36+ $ exception = new ObjectPropertyNotFound ($ this ->className , $ previous );
37+
38+ $ this ->assertSame ($ previous , $ exception ->getPrevious ());
39+ }
40+
41+ public function testImplementsReaderExceptionInterface (): void
42+ {
43+ $ exception = new ObjectPropertyNotFound ($ this ->className );
44+
45+ $ this ->assertInstanceOf (ReaderException::class, $ exception );
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments