Skip DB tests if MYSQL_* environment variables are missing
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 4 Aug 2018 14:35:31 +0000 (16:35 +0200)
committerHypolite Petovan <mrpetovan@gmail.com>
Sat, 4 Aug 2018 14:35:31 +0000 (16:35 +0200)
tests/DatabaseTest.php

index 88cc2d8..9844699 100644 (file)
@@ -32,6 +32,10 @@ abstract class DatabaseTest extends TestCase
         */
        protected function getConnection()
        {
+               if (!getenv('MYSQL_DATABASE')) {
+                       $this->markTestSkipped('Please set the MYSQL_* environment variables to your test database credentials.');
+               }
+
                if (!DBA::connected()) {
                        $this->markTestSkipped('Could not connect to the database.');
                }