@@ -139,6 +139,43 @@ public function testConfigEntityExample() {
139
139
$ this ->drupalGet ('/examples/config-entity-example ' );
140
140
$ this ->assertText ($ robby_label );
141
141
$ this ->assertText ($ robby_machine_name );
142
+
143
+ // 6) Verify that required links are present on respective paths.
144
+ $ this ->assertLinkByHref ('/examples/config-entity-example/add ' );
145
+ $ this ->assertLinkByHref ('/examples/config-entity-example/manage/robby_machine_name ' );
146
+ $ this ->assertLinkByHref ('/examples/config-entity-example/manage/robby_machine_name/delete ' );
147
+
148
+ // Verify links on Add Robot.
149
+ $ this ->drupalGet ('/examples/config-entity-example/add ' );
150
+ $ this ->assertActionButton ('examples/config-entity-example ' );
151
+
152
+ // Verify links on Edit Robot.
153
+ $ this ->drupalGet ('/examples/config-entity-example/manage/robby_machine_name ' );
154
+ $ this ->assertLinkByHref ('/examples/config-entity-example/manage/robby_machine_name/delete ' );
155
+ $ this ->assertActionButton ('examples/config-entity-example ' );
156
+
157
+ // Verify links on Delete Robot.
158
+ $ this ->drupalGet ('/examples/config-entity-example/manage/robby_machine_name/delete ' );
159
+ // List page will be the destination of the cancel link.
160
+ $ cancel_button = $ this ->xpath (
161
+ '//a[@id="edit-cancel" and contains(@href, :path)] ' ,
162
+ [':path ' => '/examples/config-entity-example ' ]
163
+ );
164
+ $ this ->assertEqual (count ($ cancel_button ), 1 , 'Found cancel button linking to list page. ' );
165
+ }
166
+
167
+ /**
168
+ * Wrap an assertion for the action button.
169
+ *
170
+ * @param string $path
171
+ * Drupal path to a page.
172
+ */
173
+ protected function assertActionButton ($ path ) {
174
+ $ button_element = $ this ->xpath (
175
+ '//a[contains(@class, "button-action") and contains(@data-drupal-link-system-path, :path)] ' ,
176
+ [':path ' => $ path ]
177
+ );
178
+ $ this ->assertEqual (count ($ button_element ), 1 , 'Found action button for path: ' . $ path );
142
179
}
143
180
144
181
}
0 commit comments