You are here

public function MultifieldDevelGenerateTestCase::testDevelGenerate in Multifield 7

Same name and namespace in other branches
  1. 7.2 tests/MultifieldDevelGenerateTestCase.test \MultifieldDevelGenerateTestCase::testDevelGenerate()

File

tests/MultifieldDevelGenerateTestCase.test, line 66

Class

MultifieldDevelGenerateTestCase

Code

public function testDevelGenerate() {

  // Copied from devel_generate_content_add_node()
  $node = new stdClass();
  $node->nid = NULL;
  $node->type = $this->nodeType->type;
  node_object_prepare($node);
  $node->uid = 0;
  $node->title = 'Devel generate test';
  $node->language = LANGUAGE_NONE;
  module_load_includE('inc', 'devel_generate');
  module_load_include('inc', 'devel_generate', 'devel_generate.fields');
  devel_generate_fields($node, 'node', $node->type);
  $items = field_get_items('node', $node, 'field_multifield');
  $this
    ->assertTrue($items);
  $this
    ->assertTrue($items[0]['field_text'][LANGUAGE_NONE][0]['value']);
  $this
    ->assertTrue($items[0]['field_text'][LANGUAGE_NONE][0]['format']);
  $this
    ->assertTrue($items[0]['field_image'][LANGUAGE_NONE][0]['fid']);
  $this
    ->assertTrue($items[0]['field_image'][LANGUAGE_NONE][0]['alt']);
  $this
    ->assertTrue($items[0]['field_image'][LANGUAGE_NONE][0]['title']);
}