From 20accbbd19ec5482aa075a924cb16dc372fdd330 Mon Sep 17 00:00:00 2001 From: taipt-0504 Date: Mon, 15 Jun 2020 17:03:08 +0700 Subject: [PATCH] Unit test --- tests/C0/ProcessRunnerTest.php | 51 +++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/tests/C0/ProcessRunnerTest.php b/tests/C0/ProcessRunnerTest.php index 4966ff0..c13bda8 100644 --- a/tests/C0/ProcessRunnerTest.php +++ b/tests/C0/ProcessRunnerTest.php @@ -2,9 +2,58 @@ namespace Tests\C0; +use App\ProcessRunner; use PHPUnit\Framework\TestCase; class ProcessRunnerTest extends TestCase { - // TODO: write 2 tests to coverage 100% code + private $processRunner; + + public function __construct() + { + parent::__construct(); + $this->processRunner = new ProcessRunner(); + } + + public function testRunWhenIf1TrueAndIf2True() + { + $result = $this->processRunner->run(12, 3); + + $this->assertEquals(2, $result); + } + + public function testRunWhenIf1FalseAndIf2Fasle() + { + $result = $this->processRunner->run(7, 5); + + $this->assertEquals(2, $result); + } + + public function testWasProcess1Called() + { + $result = $this->processRunner->wasProcess1Called(); + + $this->assertFalse($result); + } + + public function testWasProcess2Called() + { + $result = $this->processRunner->wasProcess2Called(); + + $this->assertFalse($result); + } + + public function testWasProcess3Called() + { + $result = $this->processRunner->wasProcess3Called(); + + $this->assertFalse($result); + } + + public function testWasProcess4Called() + { + $result = $this->processRunner->wasProcess4Called(); + + $this->assertFalse($result); + } }