You are here

private function PatternsContentTypeTestCase::testCreate in Patterns 7.2

Same name and namespace in other branches
  1. 7 tests/node/content.test \PatternsContentTypeTestCase::testCreate()
1 call to PatternsContentTypeTestCase::testCreate()
PatternsContentTypeTestCase::testCreateModifyDelete in tests/node/content.test

File

tests/node/content.test, line 37
SimpleTests for the Node component of Patterns (Content Types).

Class

PatternsContentTypeTestCase
@file SimpleTests for the Node component of Patterns (Content Types).

Code

private function testCreate() {

  // The content type should not exist at this point.
  $node_type_count = db_select('node_type', 'n')
    ->fields('n', array(
    'type',
  ))
    ->condition('type', 'test_content_type')
    ->countQuery()
    ->execute()
    ->fetchField();
  $this
    ->assertIdentical($node_type_count, '0', t('The content type should not exist at this point.'));

  // Run the pattern.
  parent::runFile('content.yaml', 'Content Type (create)', $this->node_tests_dir);

  // Expected messages.
  $this
    ->assertUniqueText(t('The content type Test Content Type has been added.'));

  // The content type should exist with the right values.
  $node_type = db_select('node_type', 'n')
    ->fields('n')
    ->condition('type', 'test_content_type')
    ->execute()
    ->fetchAll();
  $this
    ->assertIdentical(count($node_type), 1);
  $this
    ->assertIdentical($node_type[0]->name, 'Test Content Type');
  $this
    ->assertIdentical($node_type[0]->base, 'node_content');
  $this
    ->assertIdentical($node_type[0]->module, 'node');
  $this
    ->assertIdentical($node_type[0]->description, 'Test Content Type Long Description');
  $this
    ->assertIdentical($node_type[0]->help, 'help text');

  // TODO
  $this
    ->assertIdentical($node_type[0]->has_title, '1');

  // TODO
  // TODO: more fields
}