I'm not sure if this is a bug or misuse, however please consider that
calling

function setUp() {
...
    $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Page'));
...
}

produces a fail. However the test (in my case) resumes normally after that.

I guess the problem is the following lines from drupal_web_test_case.php:

protected function drupalCreateContentType($settings = array()) {
...
    // Populate defaults array.
    $defaults = array(
      'type' => $name,
      'name' => $name,
...
    $type = $forced + $settings + $defaults; // <-- custom type gets overridden by $defaults.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Project: Test driven development infrastructure » Drupal core
Version: » 7.x-dev
Component: Code » simpletest.module
Category: bug » support
Status: Active » Postponed (maintainer needs more info)

Thanks for your report. Could you elaborate on what you mean by "produces a fail"?

The code you pasted looks ok (the + operator in PHP does not override keys from the left operand), so I'm requalifying this as a support request until you can provide more information.

lex0r’s picture

You are right regarding the keys, but the issue happens anyway.
I attached a screenshot. Hope it will clarify the issue...

lex0r’s picture

Version: 7.x-dev » 7.8
Status: Postponed (maintainer needs more info) » Active

Made it "active" to attract attention...

lex0r’s picture

Bump!

lex0r’s picture

Category: support » bug
Priority: Normal » Major

Still no feedback. I want the issue to be either confirmed as bug, or closed.
You may reproduce the issue by running test suite for menu_import module.

xjm’s picture

Version: 7.8 » 7.x-dev
Category: bug » support
Priority: Major » Normal

Whatever this is, it's certainly not a major bug. There's likely some problem with your test case code.

lex0r’s picture

Ok, then I would like anyone who's expert in Drupal unit testing to take a look at it and tell me what's wrong. Please :)

  function setUp() {
    parent::setUp('menu_import');
    $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Page'));
    $this->privileged_user = $this->drupalCreateUser(array(
      'import menu from file',
      ));
    $this->drupalLogin($this->privileged_user);
  }

I just create a new CT for testing purposes (no more code regarding this CT exists) and get the error.