This information is from the code coverage report (see http://coverage.cwgordon.com/coverage).

We need to test:

1) Configuring the default filter.
2) A format with no filters.
3) Attempting to add a duplicate filter name.
4) Attempting to delete the default filter.

Comments

catch’s picture

Title: Tests needed: filter.admin.inc » TestingParty08: Filter administration
grndlvl’s picture

Assigned: Unassigned » grndlvl
mikl’s picture

Been working on this, but we didn't get it done before the session ended..

grndlvl’s picture

Status: Active » Needs review
StatusFileSize
new4.14 KB

This patch covers the following:
2) A format with no filters.
3) Attempting to add a duplicate filter name.
4) Attempting to delete the default filter.

Patch written with help from mikl.

The first one seems to have already been done.

mikl’s picture

Sweet, good job grndlvl :)

catch’s picture

Status: Needs review » Needs work

Looks pretty good and the tests run fine. Couple of minor code style issues before this is RTBC - inline comments should be written as sentences (start with capital letter, end with full stop), also we usually use $edit as the variable name for form values in drupalPost (although I'm not sure if that's a standard or just habit tbh) - and the $cannot_delete_text look unnecessary to me - about the same number of characters as putting the t calls in assertText() directly. Nice work though :)

grndlvl’s picture

Status: Needs work » Needs review
StatusFileSize
new4.2 KB

Made changes mentioned in comment #6.

-Do not really want to change variable name on line 151 to $edit from $empty_format because $empty_format is used throughout the rest of the test. And $edit is too arbitrary to be used throughout the test.

catch’s picture

Status: Needs review » Reviewed & tested by the community

$empty_format was my bad, my eyes clearly weren't working properly. Other changes look good and the tests run fine, so marking RTBC.

webchick’s picture

Status: Reviewed & tested by the community » Needs work

Code style stuff:

+    // Create format with no filters.
+    $empty_format = array(
+        'name'     => $this->randomName(),
+        'roles[2]' => 1,
+    );

Those look indented too much; possibly tabs?

+    $this->assertRaw(t('Added input format %format.', array('%format' => $empty_format['name'])), t('New empty filter created.'));

It's an empty format, not an empty filter.

+    $node_body =  $random_text. '<?php print "'. $random_text .'"; ?>'. $random_text .'<img src="'. $random_text .'" />'. $random_text; 

We concatenate with ' . ' (space on either side of the dot). There are a couple other places this needs to be changed as well.

+    $this->assertRaw($node_body, t('Everything comes across and php not eval-ed.'));

Capitalize PHP, I don't quite grok "eval-ed".. do you mean 'executed'? Come to think of it, I don't really understand this message in general. Could you be more specific about what exactly is being tested here?

In general, I'd like to see these test cases split up into separate functions rather than in one big monster list, with the code that needs to be shared between them moved to a setUp() function. Use the DB tests and the file tests, both of which were most recently added, for a guideline on how to split things up.

grndlvl’s picture

Status: Needs work » Active
lilou’s picture

Status: Active » Needs work
grndlvl’s picture

StatusFileSize
new14.12 KB

Began working on suggestions from #9, ran into issues with two of the tests. Kind of late here going to bed just placing new patch work up just in case someone felt like working on it until I get to the problems.

grndlvl’s picture

StatusFileSize
new13.44 KB

Made changes suggested by #9 throughout the whole test.

grndlvl’s picture

Status: Needs work » Needs review
Anonymous’s picture

Status: Needs review » Needs work

The last submitted patch failed testing.

grndlvl’s picture

Component: tests » filter.module
Status: Needs work » Needs review
StatusFileSize
new12.43 KB

Status: Needs review » Needs work

The last submitted patch failed testing.

grndlvl’s picture

StatusFileSize
new12.51 KB

Fixed patch. Was not done from docroot :/ whoops.

grndlvl’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch failed testing.

catch’s picture

Moving this out of the critical bugs queue - see #607038: Meta issue: fix gaps in code coverage.

sun.core’s picture

Priority: Critical » Normal

Most of this is already covered in HEAD.

However, some of the introduced test functions are really good ideas. So let's re-roll this sucker and get it in.

sun’s picture

Category: bug » task
sun’s picture

Version: 7.x-dev » 8.x-dev
wim leers’s picture

Issue summary: View changes
Status: Needs work » Closed (fixed)

Most if not all of this is already in Drupal\filter\Tests\FilterAdminTest. Filter module's test coverage has been expanded quite a bit since 2010. Closing.