You are here

function CoderReviewUpgrade7xTest::testDatabase7x in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_review/tests/coder_review_7x.test \CoderReviewUpgrade7xTest::testDatabase7x()

???

File

coder_review/tests/coder_review_7x.test, line 214

Class

CoderReviewUpgrade7xTest
???

Code

function testDatabase7x() {

  // N/A - http://drupal.org/node/224333#schema_date_time --- Schema API now supports date and time types natively
  // N/A - http://drupal.org/node/224333#foreign-keys-added
  // in test module http://drupal.org/node/224333#install-schema --- Database schema (un)installed automatically
  // http://drupal.org/node/224333#dbtng
  // http://drupal.org/node/224333#schema_translation
  $this
    ->assertCoderReviewFail("  function mymodule_schema() {\n \$schema['table'] = array(\n  'description' => t('My table description.'));\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_schema() {\n \$schema['table'] = array(\n  'description' => st('My table description.'));\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_schema() {\n \$schema['table'] = array(\n  'fields' => array('nid' => array('description' => t('My field description.'))));\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_schema() {\n \$schema['table'] = array(\n  'fields' => array('nid' => array('description' => st('My field description.'))));\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_schema() {\n \$schema['table'] = array(\n  'description' => 'My table description.');\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_schema() {\n \$schema['table'] = array(\n  'fields' => array('nid' => array('description' => 'My field description.')));\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_update_123() {\n \$schema['table'] = array(\n  'description' => st('My table description.'));\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_update_123() {\n \$schema['table'] = array(\n  'fields' => array('nid' => array('description' => t('My field description.'))));\n}");

  // http://drupal.org/node/224333#db_rewrite_sql
  $this
    ->assertCoderReviewFail('  $sql = db_rewrite_sql("SELECT n.nid FROM {node}");');

  // http://drupal.org/node/224333#schema_html
  $this
    ->assertCoderReviewFail("  function mymodule_schema() {\n \$schema['table'] = array(\n  'description' => 'My table <a href=\"foo.html\">foo</a> description.');\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_schema() {\n \$schema['table'] = array(\n  'fields' => array('nid' => array('description' => 'My field <a href=\"foo.html\">foo</a> description.')));\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_schema() {\n \$schema['table'] = array(\n  'description' => 'My table <a href=\"foo.html\">foo</a> description.');\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_schema() {\n \$schema['table'] = array(\n  'fields' => array('nid' => array('description' => 'My field <a href=\"foo.html\">foo</a> description.')));\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_update_123() {\n \$schema['table'] = array(\n  'description' => 'My table &lt;a href=\"foo.html\"&gt;foo&lt;/a&gt; description.');\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_update_123() {\n \$schema['table'] = array(\n  'fields' => array('nid' => array('description' => 'My field &lt;a href=\"foo.html\"&gt;foo&lt;/a&gt; description.')));\n}");

  // http://drupal.org/node/224333#select_count
  $this
    ->assertCoderReviewFail("  db_query( 'SELECT COUNT (*) FROM {users}')");
}