Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-9594

Missing documentation for running unit tests on sqlite

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • 3.0.7-PL1
    • Other
    • None

      Continuing the quest to run phpbb unit tests on sqlite, I now arrive at this error:

      pie@snap tests %  ../../misc/phpunit/phpunit.php dbal/all_tests.php
       
      Notice: PHPUnit >= 3.3.0 required in /home/pie/apps/phpbb3/tests/test_framework/framework.php on line 32
      PHPUnit @package_version@ by Sebastian Bergmann.
       
      ESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS 60 / 65
      SSSSS
       
      Time: 1 second, Memory: 7.25Mb
       
      There was 1 error:
       
      1) phpbb_dbal_test::test_return_on_error_select with data set #0 ('phpbb_users', 'username_clean = \'bertie\'', array(array('bertie')))
      You have to create a test_config.php like this:
      "<?php
      $dbms = 'mysqli';
      $dbhost = 'localhost';
      $dbport = '';
      $dbname = 'database';
      $dbuser = 'user';
      $dbpasswd = 'password';
      "
       
      NOTE: The database is dropped and recreated with the phpbb-db-schema! Do NOT specify a database with important data.
       
      /home/pie/apps/phpbb3/tests/test_framework/phpbb_test_case_helpers.php:47
      /home/pie/apps/phpbb3/tests/test_framework/phpbb_database_test_case.php:105
       
      FAILURES!
      Tests: 65, Assertions: 0, Errors: 1, Skipped: 64.
      

      The reason this error is particularly confusing is that above I ran tests in dbal directory. Watch what happens if I run all tests;

      pie@snap tests % phpunit all_tests.php
      PHPUnit 3.4.1 by Sebastian Bergmann.
       
      ............................................................  60 / 686
      ............................................................ 120 / 686
      IIIIIIIIIII................................................. 180 / 686
      ............................................................ 240 / 686
      ............................................................ 300 / 686
      ............................................................ 360 / 686
      ............................................................ 420 / 686
      ............................................................ 480 / 686
      ............................................................ 540 / 686
      ............................................................ 600 / 686
      .....................ESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS 660 / 686
      SSSSSSSSSSSSSSSSSSSSSSSSSS
       
      Time: 5 seconds
       
      There was 1 error:
       
      1) phpbb_dbal_test::test_return_on_error_select with data set #0 ('phpbb_users', 'username_clean = \'bertie\'', array(array('bertie')))
      You have to create a test_config.php like this:
      "<?php
      $dbms = 'mysqli';
      $dbhost = 'localhost';
      $dbport = '';
      $dbname = 'database';
      $dbuser = 'user';
      $dbpasswd = 'password';
      "
       
      NOTE: The database is dropped and recreated with the phpbb-db-schema! Do NOT specify a database with important data.
       
       
      FAILURES!
      Tests: 686, Assertions: 811, Errors: 1, Incomplete: 11, Skipped: 64.
      

      Error message is identical, which directory should the config file be in?

      This ticket covers two issues:

      1. Contents of config file for using an sqlite in-memory database should be listed either on http://wiki.phpbb.com/display/DEV/Unit+Tests or in a readme file (see http://tracker.phpbb.com/browse/PHPBB3-9593). Since in-memory sqlite configuration is identical for everyone I should be able to find it and copy-paste it into my system. I should not need to figure out what the configuration is supposed to look like.

      In the event that an in-memory database cannot be used, everything basically still applies and there needs to be a default location for the database file proposed in the sample config.

      2. The exact location of config file needs to be stated. (/tests or /tests/dbal?)

            bantu Andreas Fischer [X] (Inactive)
            Oleg Oleg [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: