Problem/Motivation

Followup from #2490818: Add help to clarify purpose and usage of bundles.

Because they're used for namespacing, most or all features developers will want to first create a bundle before generating features. However, currently, the first screen to appear on initial install is the feature generation one, with "Default" selected for "Bundle". Users may proceed to generate features and only later discover that they should first have created one or more bundles.

Proposed resolution

If no bundles have yet been created, at admin/config/development/features generate a message. Draft:

You have not yet created any bundles. Before generating features, you may wish to [link]create a bundle[/link] to group your features within.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nedjo created an issue. See original summary.

nedjo’s picture

Status: Active » Needs work
Issue tags: +Needs tests
FileSize
1.24 KB

Patch attached, but setting to needs work pending tests.

naveenvalecha’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
1.87 KB
2.12 KB

Added tests.

naveenvalecha’s picture

+++ b/src/Tests/FeaturesCreateUITest.php
@@ -36,6 +36,8 @@ class FeaturesCreateUITest extends WebTestBase {
+    $this->assertText(t('You have not yet created any bundles. Before generating features, you may wish to create a bundle to group your features within.'), 'The text "You have not yet created any bundles. Before generating features, you may wish to create a bundle to group your features within." appears on the user register page.');

As we only need to check the message. If we need to check the features.asssignment link as well, we can move to assertRaw, Do we need to check the link in message as well ?

nedjo’s picture

@naveenvalecha: thanks for starting into work on a test!

+++ b/src/Tests/FeaturesCreateUITest.php
@@ -36,6 +36,8 @@ class FeaturesCreateUITest extends WebTestBase {
+ // Check the message is displaying if there are no custom bundles.
+ $this->assertText(t('You have not yet created any bundles. Before generating features, you may wish to create a bundle to group your features within.'), 'The text "You have not yet created any bundles. Before generating features, you may wish to create a bundle to group your features within." appears on the user register page.');

Since ::testCreateFeaturesUI() is testing the features edit form, rather than the form at admin/config/development/features (except to ensure that page includes a working local action link to the features edit form), we should put this into a different method, and probably into a new class focused on testing the form at admin/config/development/features.

We'll also need to test the contrary case, by adding a custom bundle and ensuring the message does not appear.

Do we need to check the link in message as well ?

I guess it couldn't hurt. In e.g. AddFeedTest::testAddFeed() it looks like ::assertRaw() is sometimes used to test a message.

naveenvalecha’s picture

Okay A seperate class sounds good in features_ui

We'll also need to test the contrary case, by adding a custom bundle and ensuring the message does not appear.

Added :)

naveenvalecha’s picture

  1. +++ b/modules/features_ui/src/Tests/FeaturesUITest.php
    @@ -0,0 +1,52 @@
    +   * @todo Remove the disabled strict config schema checking.
    

    ohhh yeah taken this from FeaturesCreateUITest.php to skip the config schema validation , otherwise it was failing

  2. +++ b/modules/features_ui/src/Tests/FeaturesUITest.php
    @@ -0,0 +1,52 @@
    +    // Check the message is displaying if there are no custom bundles.
    

    Comment was missing me ;)

nedjo’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, looks good! I'm leaving RTBC for a bit in case anyone else wants to take a look before we commit this.

nedjo’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks!

  • nedjo committed b21c536 on 8.x-3.x
    Issue #2653166 by naveenvalecha, nedjo: Provide message if no custom...

Status: Fixed » Closed (fixed)

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