This method fails because of two problems:

  • it uses the SEVERITY_MINOR constant, which is undefined when running the test
  • it invokes coder_review_reviews();, which is undefined until the module is loaded, which does not happen by default when running unit tests on D7
CommentFileSizeAuthor
#1 0001-Issue-1763786-testRun-fails.patch1.32 KBfgm

Comments

fgm’s picture

Status: Active » Needs review
StatusFileSize
new1.32 KB

Suggested patch avoids these errors.

douggreen’s picture

It appears to me that this would be a problem, but when I run from both the UI and drush test-run I don't see any errors. I tested on the 7.x-1.x and 7.x-2.x branches. Can you elaborate on where you get this error please :)

fgm’s picture

I used to get them when running the test on PHP 5.3 at E_STRICT with php scripts/run-tests.sh . These days it just causes a segfault. This does not happen when running from Drush, but still happens in the Web UI:

This stops the batch UI:

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /batch?id=5&op=do StatusText: OK ResponseText: ( ! ) Fatal error: Call to undefined function coder_review_reviews() in /home/marand/Dropbox/src/d7/sites/all/modules/contrib/coder/coder_review/tests/coder_review_test_case.tinc on line 21

Then in the results:
Use of undefined constant SEVERITY_MINOR - assumed 'SEVERITY_MINOR' Notice coder_review_test_case.tinc 20 CoderReviewTestCase->runTest()
Trying to get property of non-object Notice session.inc 178 _drupal_session_write()

douggreen’s picture

The attached patch doesn't seem to solve the problem for me. Before and after results below:

$ php ./scripts/run-tests.sh Coder

Drupal test run
---------------

Tests to be run:
 - Coder Comment Style Tests (CoderReviewCommentTest)
 - Coder I18N Tests (CoderReviewI18NTest)
 - Coder Security Tests (CoderReviewSecurityTest)
 - Coder SQL Tests (CoderReviewSQLTest)
 - Coder Style Tests (CoderReviewStyleTest)
 - Coder Upgrade 6.x Tests (CoderReviewUpgrade6xTest)
 - Coder Upgrade 7.x Tests (CoderReviewUpgrade7xTest)

Test run started:
 Thursday, August 30, 2012 - 17:23

Test summary
------------

Coder Comment Style Tests 33 passes, 0 fails, and 0 exceptions
Coder I18N Tests 2 passes, 0 fails, and 2 exceptions
Coder Security Tests 88 passes, 0 fails, and 12 exceptions
Coder SQL Tests 19 passes, 0 fails, and 1 exception
Coder Style Tests 57 passes, 0 fails, and 0 exceptions
Coder Upgrade 6.x Tests 30 passes, 0 fails, and 17 exceptions
Coder Upgrade 7.x Tests 17 passes, 0 fails, and 18 exceptions

Test run duration: 6 sec

Do you know how to look at those exceptions?

fgm’s picture

Status: Needs review » Needs work

No idea how to get at them in CLI mode, but in the Web UI they are normally displayed.

klausi’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

Coder 7.x-1.x is frozen now and will not receive any updates. Coder 8.x-2.x can be used to check code for any Drupal version, Coder 8.x-2.x also supports the phpcbf command to automatically fix conding standard errors. Please check if this issue is still relevant and reopen against that version if necessary.