We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 1 |
| Paths | 1 |
| Total Lines | 41 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 15 | public function test_validate_config_happy_path() { |
||
| 16 | // Given a Dotenv object |
||
| 17 | $dotEnv = $this->createMock(Dotenv::class); |
||
| 18 | $validator = $this->createMock(Validator::class); |
||
| 19 | |||
| 20 | // And the dotenv config will return the following array when loaded |
||
| 21 | $dotEnv |
||
| 22 | ->expects(self::once()) |
||
| 23 | ->method('load') |
||
| 24 | ->willReturn([ |
||
| 25 | 'MYSQL_HOST' => 'host', |
||
| 26 | 'MYSQL_USER' => 'user', |
||
| 27 | 'MYSQL_PASSWORD' => 'pass', |
||
| 28 | 'MYSQL_DATABASE' => 'database', |
||
| 29 | ]); |
||
| 30 | |||
| 31 | // And we expect that the dotenv "required" method will be called with the following arguments |
||
| 32 | $dotEnv |
||
| 33 | ->expects(self::once()) |
||
| 34 | ->method('required') |
||
| 35 | ->with([ |
||
| 36 | 'MYSQL_HOST', |
||
| 37 | 'MYSQL_USER', |
||
| 38 | 'MYSQL_PASSWORD', |
||
| 39 | 'MYSQL_DATABASE', |
||
| 40 | ]) |
||
| 41 | ->willReturn($validator); |
||
| 42 | |||
| 43 | $validator |
||
| 44 | ->expects(self::once()) |
||
| 45 | ->method('notEmpty') |
||
| 46 | ->willReturnSelf(); |
||
| 47 | |||
| 48 | // When constructing the properties class |
||
| 49 | $dbProperties = new DatabaseProperties($dotEnv); |
||
| 50 | |||
| 51 | // Then the properties have expected values |
||
| 52 | self::assertEquals('host', $dbProperties->getHost()); |
||
| 53 | self::assertEquals('user', $dbProperties->getUser()); |
||
| 54 | self::assertEquals('pass', $dbProperties->getPassword()); |
||
| 55 | self::assertEquals('database', $dbProperties->getDatabaseName()); |
||
| 56 | } |
||
| 59 |