You are here

private function PatternsNodeTestCase::testCreate in Patterns 7

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

File

tests/node/node.test, line 36
SimpleTests for the Node component of Patterns (Node).

Class

PatternsNodeTestCase
@file SimpleTests for the Node component of Patterns (Node).

Code

private function testCreate() {

  // The node should not exist at this point.
  $node_count = db_select('node', 'n')
    ->fields('n', array(
    'nid',
  ))
    ->condition('type', 'article')
    ->condition('title', 'Test Article')
    ->countQuery()
    ->execute()
    ->fetchField();
  $this
    ->assertIdentical($node_count, '0', t('The node should not exist at this point.'));

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

  // Expected messages.
  $this
    ->assertUniqueText(t('Article Test Article has been created.'));

  // The node should exist with the right values.
  $node_count = db_select('node', 'n')
    ->fields('n', array(
    'nid',
  ))
    ->condition('type', 'article')
    ->condition('title', 'Test Article')
    ->countQuery()
    ->execute()
    ->fetchField();
  $this
    ->assertIdentical($node_count, '1', t('The node should exist at this point.'));
}