Problem/Motivation

When people, especially new people, try to follow the test coding standards:
http://drupal.org/node/325974
They may find experienced developers disagreeing with them.

Following the test coding standards might be not worth doing because it need updating.

Proposed resolution

A. Update the test coding standards, making it consistant with
http://drupal.org/node/1354#files

B. Take out the parts from the tests standards that are the same as (or should be the same as) 1354

C. Add the bits about tests to 1354 because everyone knows about that doc, and no looks to see if there is a separate doc for tests.

Remaining tasks

  • decide on a resolution
  • implement what is decided

User interface changes

N/A

API changes

N/A

Comments

YesCT’s picture

For example, for D8 tests, it should probably say

For files containing the definition of exactly one class/interface, use this template:

/**
 * @file
 * Contains NameOfTheClass.
 */

instead of

/**
 * @file
 * Tests for Aggregator module.
 */

For example in #1804702: Display interface translation status

/**
 * @file
 * Contains Drupal\locale\Tests\LocaleUpdateInterfaceTest.
 */
YesCT’s picture

Also, maybe as suggested in irc, another option:

D. enlarge the Drupal 8 section

YesCT’s picture

Related:
PSR-0 is http://drupal.org/project/issues/search/drupal?issue_tags=PSR-0 and is also https://img.skitch.com/20120523-r6y7ife93b3x35yme4s6dpapds.png and is also PSR-0 compatible class loader in core Change Notice / Change Record http://drupal.org/node/1320394

YesCT’s picture

YesCT’s picture

Title: Update coding standards doc and make consistant with 1354 where appropriate » Update tests coding standards doc and make consistant with 1354 where appropriate
jhodgdon’s picture

Component: simpletest.module » documentation
Issue tags: -Documentation

Sounds like this is a coding standards/documentation issue? Should be in the documentation component, not tagged "documentation".

YesCT’s picture

could use an example of a one line for the doc block for test functions, to clarify if it should be like 1354 and be third person verb * Tests …

Right now it says, in two places:
* One-sentence description of what test entails.

YesCT’s picture

namespace standards doc give example:

/**
 * Tests that the foo bars.
 */
class BarTest extends WebTestBase {

test standards says:

 <?php
/**
 * Functional tests for the Kitten Basket.
 */
class KittenBasketTestCase extends DrupalWebTestBase {
?>
 
The comment above the class is mandatory, it is a rephrasing of the 'name' of the test found in getInfo() function ('Kitten basket functionality' -> 'Functional tests for the Kitten basket').

and 1354 says classes doc block is like:
* Defines
oh, I thought it did.. now I can't find it.

YesCT’s picture

Re #7
http://drupal.org/node/325974/revisions/view/2482710/2603306

Now has example that says: * Tests
with the third person verb.

YesCT’s picture

alexpott’s picture

I agree with B...

jhodgdon’s picture

Status: Active » Fixed

OK... I took a look at
https://drupal.org/node/325974
and it seems like the action items are all in the "Test template" section:

1. @file is not following our standards and should probably just link to the node/1354 section on @file:
https://drupal.org/node/1354#file
or else it should just include the last example from there (the "Contains..." one).

2. The class description doesn't follow our standards, because it should start with a verb as per
https://drupal.org/node/1354#classes
so we should probably just change the example to read "Tests foo functionality" or something like that.

The rest looks like it follows our standards... and I don't think these changes are controversial in any way, so I went ahead and edited the page. Here's the revision information:

If there is disagreement about what I did, we can edit the page again and/or revert my changes, but I thought I would just do it since I really don't think there is any disagreement.
https://drupal.org/node/325974/revisions/view/2672980/2742853

Provisionally marking this issue fixed.

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