Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When run Views test, this fatal error appears:
array
'type' => int 1
'message' => string 'Call to a member function set_display() on a non-object' (length=55)
'file' => string '/Volumes/Users HD/rwieczor/Sites/coi/public_html/sites/all/modules/views/tests/views_exposed_form.test' (length=102)
'line' => int 34
public function testRenameResetButton() {
$account = $this->drupalCreateUser();
$this->drupalLogin($account);
// Create some random nodes.
for ($i = 0; $i < 5; $i++) {
$this->drupalCreateNode();
}
// Look at the page and check the label "reset".
$this->drupalGet('test_rename_reset_button');
// Rename the label of the reset button.
$view = views_get_view('test_rename_reset_button');
$view->set_display('default'); // <-- THIS LINE
Comment | File | Size | Author |
---|---|---|---|
#8 | views_exposed_form.test.patch | 1.04 KB | kenorb |
Comments
Comment #1
kenorb CreditAttribution: kenorb commentedComment #2
kenorb CreditAttribution: kenorb commentedSimilar bug in Features:
#1101690: Simpletest: Fatal error: Call to a member function set_display() on a non-object in tests/features.test on line 189
Comment #3
dawehnerSo do you volunteer to fix it? If yes please assign the issue to yourself :)
Comment #4
kenorb CreditAttribution: kenorb commentedI'll try as my best, if I'll find spare time. I'm just struggling with other simpletests as well. Basically 1/3 of contrib tests provided by other modules which I've installed are very buggy.
Basically this error of non-object, means that this views doesn't exists.
On the first look, I saw that this view was defined and the path should be correct.
So probably this needs some debugging work to check why it doesn't work.
Comment #5
dawehnerThe test worked one day that's sure.
Comment #6
kenorb CreditAttribution: kenorb commentedreturns
None of them which are defined in tests/views_test.views_default.inc which is not being loaded at all (views_test module is loaded).
Comment #7
kenorb CreditAttribution: kenorb commentedComment #8
kenorb CreditAttribution: kenorb commentedI'm not sure if patch is done correctly, but it works.
Additional patch #1107912: $reset in views_include_default_views() is not passed to views_get_module_apis() is required.
Basically when following code is executed:
Before views_test module is enabled, views_get_module_apis() is executed (during menu_rebuild) which doesn't include views_api of views_test and all module APIs are cached ($cache). So no new View files are included after that.
Could be related to same issues with Simpletest:
#440836: Error when installation uses module_exists()
#440824: Reset module_list() and module_implements() on test setup.
#360925: Need to reset module_list()
But I don't know which one exactly.
Comment #9
kenorb CreditAttribution: kenorb commentedComment #10
dawehnerAre there other tests with this bug?
Comment #11
kenorb CreditAttribution: kenorb commentedI couldn't find any apart of this, probably:
#472684: Install non-default modules one at a time to ensure proper module list is maintained during installation hooks
See comment: http://drupal.org/node/472684#comment-1631738
Comment #12
dawehnerCommited to 6.x-3.x
Comment #14
munyivaUsing the view name as printed on using #6 really sorted my issue.