@@ 83-90 (lines=8) @@ | ||
80 | $this->assertEquals('Time Server', $failure->getCheckName()); |
|
81 | } |
|
82 | ||
83 | public function testFailureIsReturnedIfOutputWasNotCorrect() |
|
84 | { |
|
85 | $e = new TimeServer(new TcpSocketFactory); |
|
86 | $failure = $e->check(__DIR__ . '/../res/time-server/solution-wrong.php'); |
|
87 | $this->assertInstanceOf(StdOutFailure::class, $failure); |
|
88 | $this->assertNotEquals($failure->getExpectedOutput(), $failure->getActualOutput()); |
|
89 | $this->assertEquals('Time Server', $failure->getCheckName()); |
|
90 | } |
|
91 | ||
92 | public function testSuccessIsReturnedIfOutputIsCorrect() |
|
93 | { |
|
@@ 99-106 (lines=8) @@ | ||
96 | $this->assertInstanceOf(Success::class, $success); |
|
97 | } |
|
98 | ||
99 | public function testProcessIsStoppedIfStillRunning() |
|
100 | { |
|
101 | $e = new TimeServer(new TcpSocketFactory); |
|
102 | $failure = $e->check(__DIR__ . '/../res/time-server/solution-keep-running.php'); |
|
103 | $this->assertInstanceOf(Failure::class, $failure); |
|
104 | $this->assertEquals('', $failure->getReason()); |
|
105 | $this->assertEquals('Time Server', $failure->getCheckName()); |
|
106 | } |
|
107 | ||
108 | public function testFailureIsReturnedIfProcessWasNotSuccessful() |
|
109 | { |
|
@@ 108-115 (lines=8) @@ | ||
105 | $this->assertEquals('Time Server', $failure->getCheckName()); |
|
106 | } |
|
107 | ||
108 | public function testFailureIsReturnedIfProcessWasNotSuccessful() |
|
109 | { |
|
110 | $e = new TimeServer(new TcpSocketFactory); |
|
111 | $failure = $e->check(__DIR__ . '/../res/time-server/solution-bad-exit.php'); |
|
112 | $this->assertInstanceOf(Failure::class, $failure); |
|
113 | $this->assertEquals('', $failure->getReason()); |
|
114 | $this->assertEquals('Time Server', $failure->getCheckName()); |
|
115 | } |
|
116 | } |
|
117 |