This repository was archived by the owner on Mar 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace MichaelRubel \LoopFunctions \Tests ;
4+
5+ use Illuminate \Support \Collection ;
6+ use MichaelRubel \LoopFunctions \Tests \Boilerplate \TestClass ;
7+
8+ class RecursiveClassDumpTest extends TestCase
9+ {
10+ /** @test */
11+ public function testCanDumpClassProperties ()
12+ {
13+ $ properties = app (TestClass::class)->dumpProperties ();
14+
15+ $ this ->assertTrue ($ properties ['bool ' ]);
16+ $ this ->assertStringContainsString ( 'new string ' , $ properties ['string ' ]);
17+ $ this ->assertArrayHasKey ('array ' , $ properties ['array ' ]);
18+ $ this ->assertTrue ($ properties ['collection ' ]->isEmpty ());
19+ $ this ->assertArrayHasKey ('static ' , $ properties ['static ' ]);
20+
21+ $ this ->assertNull ($ properties ['nullable_string ' ]);
22+ $ this ->assertNull ($ properties ['nullable_array ' ]);
23+ $ this ->assertNull ($ properties ['nullable_collection ' ]);
24+ $ this ->assertNull ($ properties ['nullable_static_array ' ]);
25+ }
26+
27+ /** @test */
28+ public function testCanDumpPassedObjectProperties ()
29+ {
30+ $ properties = app (TestClass::class)->dumpProperties (Collection::class);
31+
32+ $ this ->assertArrayHasKey ('items ' , $ properties );
33+ $ this ->assertArrayHasKey ('escapeWhenCastingToString ' , $ properties );
34+ $ this ->assertFalse ($ properties ['escapeWhenCastingToString ' ]);
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments