. */ class FrameworkBootstrapTest extends TestCase { /** * Own IP address */ private static $ipAddress = FALSE; /** * Setup test case */ public function setUp() { // Trace message //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); // Call parent method parent::setUp(); // Trace message //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__); } /** * Setup test case */ public static function setUpBeforeClass() { // Trace message //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); // Call parent method parent::setUpBeforeClass(); // Lookup own IP address self::$ipAddress = ConsoleTools::acquireSelfIpAddress(); // Trace message //* NOISY-DEBUG: */ printf('[%s:%d]: EXIT!' . PHP_EOL, __METHOD__, __LINE__); } /** * Tests setting an empty default timezone */ public function testSettingEmptyDefaultTimezone () { // Will throw this exception $this->expectException(InvalidArgumentException::class); // Test it FrameworkBootstrap::setDefaultTimezone(''); } /** * Tests setting invalid timezone */ public function testSettingInvalidDefaultTimezone () { // Expect Notice $this->expectException(Notice::class); // Try to set it FrameworkBootstrap::setDefaultTimezone('!invalid!'); } /** * Tests setting valid timezone */ public function testSettingValidDefaultTimezone () { // Will be true $this->assertTrue(FrameworkBootstrap::setDefaultTimezone('Europe/Berlin')); } /** * Tests if detectServerAddress() is returning what it should for tests. * This will always be 127.0.0.1. */ public function testConfigDetectServerAddress () { // Call it $serverAddress = FrameworkBootstrap::detectServerAddress(); // Should be the same $this->assertEquals(self::$ipAddress, $serverAddress); } /** * Re-tests if detectServerAddress() is returning what it should for tests. * This will always be 127.0.0.1. This method should not invoke * ConsoleTools's method as the configuration entry is already cached. */ public function testConfigDetectServerAddressCached () { // Call it $serverAddress = FrameworkBootstrap::detectServerAddress(); // Should be the same $this->assertEquals(self::$ipAddress, $serverAddress); } }