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
CommentFileSizeAuthor
#8 views_exposed_form.test.patch1.04 KBkenorb
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kenorb’s picture

Call Stack
# Time Memory Function Location
1 0.0003 61244 {main}( ) ../index.php:0
2 0.4668 33397280 menu_execute_active_handler( $path = ??? ) ../index.php:18
3 0.4738 34060772 call_user_func_array ( 'system_batch_page', array () ) ../menu.inc:348
4 0.4738 34061004 system_batch_page( ) ../menu.inc:0
5 0.4748 34146212 _batch_page( ) ../system.admin.inc:1841
6 0.7858 34159744 _batch_progress_page_nojs( ) ../batch.inc:39
7 2.0030 50175604 _batch_process( array ('sets' => array (0 => array (...)), 'current_set' => 0, 'progressive' => TRUE, 'url' => 'batch', 'source_page' => 'admin/build/testing', 'redirect' => 'admin/build/testing/results/4', 'id' => '23', 'error_message' => 'Please continue to <a href="/batch?id=23&amp;op=finished">the error page</a>', 'running' => TRUE) ) ../batch.inc:147
8 2.0031 50180356 call_user_func_array ( '_simpletest_batch_operation', array (0 => array (0 => 'ViewsAccessTest', 1 => 'ViewsAnalyzeTest', 2 => 'ViewsArgumentDefaultTest', 3 => 'viewsArgumentValidatorTest', 4 => 'ViewsBasicTest', 5 => 'ViewsCacheTest', 6 => 'ViewsExposedFormTest', 7 => 'ViewsGlossaryTestCase', 8 => 'ViewsHandlersTest', 9 => 'viewsModuleTest', 10 => 'ViewsPagerTest', 11 => 'ViewsQueryGroupByTest', 12 => 'viewsTranslatableTest', 13 => 'viewsViewTest'), 1 => '4', 2 => array ('sandbox' => array (...), 'results' => array (...), 'finished' => 1, 'message' => '')) ) ../batch.inc:190
9 2.0031 50180500 _simpletest_batch_operation( $test_list_init = array (0 => 'ViewsAccessTest', 1 => 'ViewsAnalyzeTest', 2 => 'ViewsArgumentDefaultTest', 3 => 'viewsArgumentValidatorTest', 4 => 'ViewsBasicTest', 5 => 'ViewsCacheTest', 6 => 'ViewsExposedFormTest', 7 => 'ViewsGlossaryTestCase', 8 => 'ViewsHandlersTest', 9 => 'viewsModuleTest', 10 => 'ViewsPagerTest', 11 => 'ViewsQueryGroupByTest', 12 => 'viewsTranslatableTest', 13 => 'viewsViewTest'), $test_id = '4', $context = array ('sandbox' => array ('max' => 14, 'tests' => array (...), 'test_results' => array (...)), 'results' => array ('test_id' => '4'), 'finished' => 1, 'message' => '') ) ../batch.inc:0
10 3.2894 63622812 DrupalTestCase->run( ) ../simpletest.module:214
11 15.8900 70282948 ViewsExposedFormTest->testRenameResetButton( ) ../drupal_web_test_case.php:429
Variables in local scope (#11)
$account =
object(stdClass)[183]
  public 'uid' => string '3' (length=1)
  public 'name' => string 's479346WPYPaK18' (length=15)
  public 'pass' => string 'd7ba0b1b184f1c605f998774fbebbc28' (length=32)
  public 'mail' => string 's479346WPYPaK18@example.com' (length=27)
  public 'mode' => string '0' (length=1)
  public 'sort' => string '0' (length=1)
  public 'threshold' => string '0' (length=1)
  public 'theme' => string '' (length=0)
  public 'signature' => string '' (length=0)
  public 'signature_format' => string '0' (length=1)
  public 'created' => string '1300796294' (length=10)
  public 'access' => string '1300796294' (length=10)
  public 'login' => string '0' (length=1)
  public 'status' => string '1' (length=1)
  public 'timezone' => null
  public 'language' => string '' (length=0)
  public 'picture' => string '' (length=0)
  public 'init' => string '' (length=0)
  public 'data' => string 'a:0:{}' (length=6)
  public 'roles' => 
    array
      2 => string 'authenticated user' (length=18)
      3 => string 's4793469jUMW76I' (length=15)
  public 'pass_raw' => string 'VVXu66DoYh' (length=10)

 

kenorb’s picture

dawehner’s picture

So do you volunteer to fix it? If yes please assign the issue to yourself :)

kenorb’s picture

I'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.

dawehner’s picture

The test worked one day that's sure.

kenorb’s picture

  public function testRenameResetButton() {
...

    $views = views_get_all_views();
    print_r(array_keys($views)); exit;

returns

$ drush test-run ViewsExposedFormTest
Array
(
    [0] => comments_recent
    [1] => tracker
    [2] => frontpage
    [3] => glossary
    [4] => archive
    [5] => taxonomy_term
)

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).

kenorb’s picture

Assigned: Unassigned » kenorb
kenorb’s picture

Status: Active » Needs review
FileSize
1.04 KB

I'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:

  public function setUp() {
    parent::setUp('views', 'views_ui', 'views_test');
...

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.

kenorb’s picture

Assigned: kenorb » Unassigned
dawehner’s picture

Are there other tests with this bug?

kenorb’s picture

dawehner’s picture

Status: Needs review » Fixed

Commited to 6.x-3.x

Status: Fixed » Closed (fixed)

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

munyiva’s picture

Issue summary: View changes

Using the view name as printed on using #6 really sorted my issue.