diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 15e2b0ba9..c6f6b1d60 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -19,10 +19,50 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; use phpOMS\DataStorage\Session\HttpSession; use phpOMS\Log\FileLogger; -var_dump($_SERVER); -var_dump(php_uname()); -var_dump(getenv()); -var_dump(ini_get_all()); +$IS_GITHUB = false; + +$temp = \array_keys($_SERVER); +foreach ($temp as $key) { + if (\stripos(\strtolower($key), 'github') !== false) { + $IS_GITHUB = true; + + break; + } +} + +if (!$IS_GITHUB) { + foreach ($_SERVER as $value) { + if (\stripos(\strtolower($value), 'github') !== false) { + $IS_GITHUB = true; + + break; + } + } +} + +$temp = \array_keys(\getenv()); +if (!$IS_GITHUB) { + foreach ($temp as $key) { + if (\stripos(\strtolower($key), 'github') !== false) { + $IS_GITHUB = true; + + break; + } + } +} + +$temp = \array_values(\getenv()); +if (!$IS_GITHUB) { + foreach ($temp as $value) { + if (\stripos(\strtolower($value), 'github') !== false) { + $IS_GITHUB = true; + + break; + } + } +} + +$GLOBALS['is_github'] = $IS_GITHUB; // Initialize file logger with correct path $tmp = FileLogger::getInstance(__DIR__ . '/../Logs'); diff --git a/tests/Message/Mail/ImapTest.php b/tests/Message/Mail/ImapTest.php index d451956ab..644b9a5de 100644 --- a/tests/Message/Mail/ImapTest.php +++ b/tests/Message/Mail/ImapTest.php @@ -39,6 +39,12 @@ final class ImapTest extends \PHPUnit\Framework\TestCase ); } + if ($GLOBALS['is_github']) { + $this->markTestSkipped( + 'Imap is not working in github actions' + ); + } + $this->handler = new Imap('testuser', 'testuser', 143); $this->handler->host = '127.0.0.1'; $this->handler->flags = '/imap/notls/norsh/novalidate-cert'; diff --git a/tests/Message/Mail/Pop3Test.php b/tests/Message/Mail/Pop3Test.php index 841e5d5e9..6f5a2c360 100644 --- a/tests/Message/Mail/Pop3Test.php +++ b/tests/Message/Mail/Pop3Test.php @@ -39,6 +39,12 @@ final class Pop3Test extends \PHPUnit\Framework\TestCase ); } + if ($GLOBALS['is_github']) { + $this->markTestSkipped( + 'Imap is not working in github actions' + ); + } + $this->handler = new Pop3('testuser', 'testuser', 110); $this->handler->host = '127.0.0.1'; $this->handler->flags = '/pop3/notls';