We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class MySqlDatabaseTest extends TestCase { |
||
| 13 | private Container $container; |
||
| 14 | private $mysql; |
||
| 15 | |||
| 16 | protected function setUp(): void { |
||
| 17 | DiContainer::initializeContainer(); |
||
| 18 | $this->container = DiContainer::getContainer(); |
||
| 19 | $this->mysql = $this->createMock(mysqli::class); |
||
| 20 | // Replace the factory definition for mysqli object with our mock, so when |
||
| 21 | // requesting a mysqli instance, it will always return a mock for this test |
||
| 22 | $this->container->set(mysqli::class, $this->mysql); |
||
| 23 | } |
||
| 24 | |||
| 25 | public function test__construct_happy_path() { |
||
| 26 | $this->mysql |
||
| 27 | ->expects(self::once()) |
||
| 28 | ->method("character_set_name") |
||
| 29 | ->willReturn("utf8"); |
||
| 30 | $mysqlDatabase = $this->container->get(MySqlDatabase::class); |
||
| 31 | $this->assertNotNull($mysqlDatabase); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function test__construct_invalid_character_set_throws_exception() { |
||
| 42 | } |
||
| 43 | } |
||
| 44 |