Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#980 [dbunit] remove dependency on discontinued dbunit #14321

Merged
merged 1 commit into from
May 25, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented May 24, 2019

Overview

Remove obsolete phphunit/dbunit package from our test suite

sebastianbergmann/dbunit#217

Removing our dependency on this removes a hurdle in supporting more recent phpunit versions since we need to migrate over our own classes to extend the namespaced classes, but currently they extend a dbunit class so getting rid of that is a first useful step.

Before

phpunit/dbunit used in tests

After

phpunit/dbunit not used in tests

Technical Details

I came into this as the path to updating our phpunit version expectations requires us to start changing how we call phpunit & the path for this is much less clear ... and then it stops

The phpunit/dbunit package has been discontinued. I've removed the reference to it from the top level
extends and one call to it & the test I tried locally passes so it's not needed for ALL tests.

Let's see where it IS needed & what our options are - have at it jenkins

Comments

@civibot
Copy link

civibot bot commented May 24, 2019

(Standard links)

@eileenmcnaughton
Copy link
Contributor Author

test this please

@seamuslee001
Copy link
Contributor

@eileenmcnaughton seems to be a problem

RUN:[[./scripts/phpunit --tap --log-junit '/home/jenkins/workspace/CiviCRM-Core-PR@3/junit/CRM_AllTests.xml' '--exclude-group' 'ornery' 'CRM_AllTests']]
TAP version 13
DB_DataObject Error: No database name / dsn found anywhere

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 odd because it only failed on the cachekey last run

@seamuslee001
Copy link
Contributor

@eileenmcnaughton no it also failed on that previously if you clicked on test result you will have seen about 2000 tests missed because there was no xml file for it

@eileenmcnaughton
Copy link
Contributor Author

hmm I don't see any skipped yet this run - will wait

@seamuslee001
Copy link
Contributor

@eileenmcnaughton you can see here https://test.civicrm.org/job/CiviCRM-Core-PR/26404/testReport/ the test result is missing about 2000 tests and in the console log it has

Found EXITCODES=""
Check test results and set exit code
Missing XML: CRM_AllTests.xml

i think this will fix the CRM tests

diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php
index ca7390a1e8..3de4f1ce4f 100644
--- a/tests/phpunit/CiviTest/CiviUnitTestCase.php
+++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php
@@ -60,6 +60,12 @@ class CiviUnitTestCase extends PHPUnit_Framework_TestCase {
   use \Civi\Test\ContactTestTrait;
   use \Civi\Test\MailingTestTrait;

+  /**
+   *  Database has been initialized.
+   *
+   * @var bool
+   */
+  private static $dbInit = FALSE;

   /**
    * The database name.
@@ -281,8 +287,12 @@ class CiviUnitTestCase extends PHPUnit_Framework_TestCase {
       exit(1);
     }

+    self::getDBName();
     // reload database before each test
-    //        $this->_populateDB();
+    if (!self::$dbInit) {
+      $this->_populateDB();
+      self::$dbInit = TRUE;
+    }

     // "initialize" CiviCRM to avoid problems when running single tests
     // FIXME: look at it closer in second stage

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 OK I see now .- I've pulled this back to just deal with the YAML to get that out of the way - your suggestion didn't work for me - but I only had a quick go at it.

I see the issue is that the dataprovider is being called before the test set up & in that flow the initiation is missing

@seamuslee001
Copy link
Contributor

Test fail is unrelated changes work merging

@seamuslee001 seamuslee001 merged commit 7176ec2 into civicrm:master May 25, 2019
@seamuslee001 seamuslee001 deleted the test_dbunit branch May 25, 2019 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants