Problem/Motivation

We should be able to demonstrate that the test runner handles PHP linting errors properly.

This should be a test that uses a patch to introduce a linting problem into the PHP of Drupal core.

Proposed resolution

Create a patch that causes a linting error in a changed file. Use php -l on the patched file to discover whether there is an error.

Add the patch to this issue. That way the patch will be around forever.

Subclass DrupalCIFunctionalTestBase to write a test which applies the patch. Follow the example of DrupalCI\Tests\Application\CorePatchAppliedTest to create this test.

Remaining tasks

Follow-up to create a similar test for contrib.

User interface changes

API changes

Data model changes

Comments

Mixologic created an issue. See original summary.

mile23’s picture

mile23’s picture

StatusFileSize
new205 bytes

A patch to fail linting.

  • Mile23 committed 94b219f on 2809565-test-lint-error
    Issue #2809565: First attempt at failed linting test.
    
mile23’s picture

Status: Active » Needs review

I'd be super awesome if there were an example of this in the wild. So far I can't make the runner fail linting. I'd wager the fault is in Patch::getModifiedFiles(), or else I'm doing something wrong.

mile23’s picture

Status: Needs review » Active

Note I'm definitely not assigned to this issue. Please patch dev as desired. :-)

legovaer’s picture

I thought that the scope for this issue was a D.O. module that contains a syntax error. Therefore, I've created drupalci_d8_module_snytax_error

legovaer’s picture

As I said before, the scope is not 100% clear. But: I've created a patch for an existing module which introduced a syntax error:

https://www.drupal.org/pift-ci-job/488073

mile23’s picture

Issue summary: View changes

Updated IS.

The testbot figures out which files have been patched, and then lints only those files using php -l. So in order to find out if the testbot does the right thing when it encounters an error like that, we have to patch the error into the code.

Mixologic’s picture

StatusFileSize
new213 bytes

Two probs with that fail patch. One, we only lint php files, which we determine by looking for <?php at the start of a fail, since this didnt match that pattern, it never thought it should lint it.

Second was that we were only doing a git diff --name-only to show modified files. Which only shows modified files, and not new files. So I fixed that also, elsewhere.

Mixologic’s picture

StatusFileSize
new186 bytes

Surprisingly difficult to get the right kind of phplinting failure.

Mixologic’s picture

This was done a while ago.

Mixologic’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.