-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#11 chor: add test for database and employee class
- Loading branch information
1 parent
0e3c70f
commit 15b5203
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
use PHPUnit\Framework\TestCase; | ||
require_once "service/DBApi.php"; | ||
require_once "classes/Employee.php"; | ||
|
||
class DatabaseTest extends TestCase | ||
{ | ||
private DBConfig $db; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->db = new DBConfig; | ||
} | ||
|
||
/** | ||
* @throws Exception | ||
*/ | ||
public function testGetConnection(): void | ||
{ | ||
$result = $this->db::connect(); | ||
$this->assertInstanceOf(mysqli::class, $result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
use PHPUnit\Framework\TestCase; | ||
require_once "service/DBApi.php"; | ||
require_once "classes/Employee.php"; | ||
|
||
class StackTest extends TestCase | ||
{ | ||
public function getEmployees() | ||
{ | ||
$api = new DBApi(); | ||
$employee = new Employee($api); | ||
|
||
$employees = $employee->getAllEmployees(); | ||
$this->assertSame(12, count($employees)); | ||
} | ||
} |