Follow up for #2027587: Add tests for custom blocks, contact forms, formats, shortcut listings and settings pages.

Updated: Comment #0

Problem/Motivation

Since the two tests issues have been committed,
#2027587: Add tests for custom blocks, contact forms, formats, shortcut listings and settings pages.
and
#2004710: Add tests for block, menu, vocabulary and views listings
@alexpott pointed out that the call to the procedural function strtolower from the class, should actually just directly call the OO method that it is a wrapper for. This will allow the dependencies to be lazy loaded. (We can check for these kind of things if using an IDE like phpstorm by right clicking on procedural functions in classes and seeing if they are simple wrappers around other class methods.)

Also, there is some comment cut and pasted that is

    // Set the machine name so later the translate link can be build.

build should be built.

See: #2027857: Blocks operations cannot be altered for an example of the use to be added and how to call the method strtolower.

Also, the setUp should be public, and the tests should be public.
see the simpletest standards: https://drupal.org/node/325974

Proposed resolution

use
Unicode::strtolower($this->randomName(16));
and fix the grammar.

Remaining tasks

  • create patch

User interface changes

No.

API changes

No.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

YesCT’s picture

Issue summary: View changes

clarified it's the dependencies that can be autoloaded.

David Hernández’s picture

I think that's what is needed.

Gábor Hojtsy’s picture

Status: Active » Needs work
+++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.phpundefined
@@ -57,8 +58,8 @@ class ConfigTranslationListUITest extends WebTestBase {
-    // Set the machine name so later the translate link can be build.
-    $block_machine_name = drupal_strtolower($this->randomName(16));
+    // Set the machine name so later the translate link can be built.
+    $block_machine_name = Unicode::strtolower($this->randomName(16));

I think later should go later. As in "can be built later" not "later... can be built".

@YesCT also says this appears in multiple places, not just this one.

+++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.phpundefined
@@ -148,5 +149,4 @@ class ConfigTranslationListUITest extends WebTestBase {
-
-}
+}
\No new line at end of file

The newline should be kept at the end of the file :)

David Hernández’s picture

Status: Needs work » Needs review
FileSize
1.78 KB
2.59 KB

Ok, I fixed the comment, added the newline and replaced the rest of strtolower functions I found.

Status: Needs review » Needs work

The last submitted patch, clean-up-added-tests-2028067-3.patch, failed testing.

David Hernández’s picture

Status: Needs work » Needs review
FileSize
4.49 KB

Re-rolling

David Hernández’s picture

Missed one change after the reroll. Here's the correct one.

vijaycs85’s picture

All good except one minor.

+++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.phpundefined
@@ -266,5 +267,4 @@ class ConfigTranslationListUITest extends WebTestBase {
   }
-
 }

Needs a line here as per https://drupal.org/node/608152#indenting. otherwise, it is RTBC for me.

David Hernández’s picture

Fixed. Thanks!

vijaycs85’s picture

Status: Needs review » Reviewed & tested by the community

#8 looks good to me.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Yay, thanks, committed.

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

Anonymous’s picture

Issue summary: View changes

adding another clean up for public methods in the test.