File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Differ ;
4+
5+ use PHPUnit \Framework \TestCase ;
6+ use PHPUnit \Framework \Attributes \CoversClass ;
7+ use Differ \DisplayCommand ;
8+ use Fixtures \CommandLineParsersStub ;
9+
10+ #[CoversClass(DisplayCommand::class)]
11+ class DisplayCommandTest extends TestCase
12+ {
13+ public $ displayCmd ;
14+ private $ file1Content ;
15+ private $ file2Content ;
16+
17+ protected function setUp (): void
18+ {
19+ $ this ->displayCmd = new DisplayCommand ();
20+
21+ $ this ->file1Content =
22+ [
23+ "id " => "none " ,
24+ "host " => "hexlet.io " ,
25+ "timeout " => 50
26+ ];
27+ $ this ->file2Content =
28+ [
29+ "timeout " => 20 ,
30+ "verbose " => 1 ,
31+ "host " => "hexlet.io "
32+ ];
33+ }
34+
35+ public function testInstance ()
36+ {
37+ $ this ->assertInstanceOf (DisplayCommand::class, $ this ->displayCmd );
38+ }
39+
40+ public function testExecute ()
41+ {
42+ $ filesDiffCmd = $ this ->createConfiguredStub (
43+ FilesDiffCommand::class,
44+ [
45+ 'getFilesContent ' =>
46+ [
47+ "FILE1 " => $ this ->file1Content ,
48+ "FILE2 " => $ this ->file2Content
49+ ]
50+ ]
51+ );
52+
53+ $ this ->assertInstanceOf (DisplayCommand::class, $ this ->displayCmd
54+ ->execute ($ filesDiffCmd ));
55+ }
56+
57+ public function testGetDiffs ()
58+ {
59+ $ this ->assertEquals ("{ \n} \n" , $ this ->displayCmd ->getDiffs ());
60+ }
61+ }
You can’t perform that action at this time.
0 commit comments