You are here

function RegistryParseFilesTestCase::testRegistryParseFiles in SimpleTest 7

testRegistryParseFiles

File

tests/registry.test, line 96

Class

RegistryParseFilesTestCase

Code

function testRegistryParseFiles() {
  _registry_parse_files($this
    ->getFiles());
  foreach ($this->fileTypes as $fileType) {

    // Test that we have all the right resources.
    foreach (array(
      'className',
      'interfaceName',
    ) as $resource) {
      $foundName = db_query('SELECT name FROM {registry} WHERE name = :name', array(
        ':name' => $this->{$fileType}->{$resource},
      ))
        ->fetchField();
      $this
        ->assertTrue($this->{$fileType}->{$resource} == $foundName, t('Resource "@resource" found.', array(
        '@resource' => $this->{$fileType}->{$resource},
      )));
    }

    // Test that we have the right file creation and modification dates.
    $dates = db_query('SELECT filectime, filemtime FROM {registry_file} WHERE filename = :filename', array(
      ':filename' => $this->{$fileType}->fileName,
    ))
      ->fetchObject();
    $this
      ->assertEqual($dates->filectime, filectime($this->{$fileType}->fileName), t('File creation date matches for %filename.', array(
      '%filename' => $this->{$fileType}->fileName,
    )));
    $this
      ->assertEqual($dates->filemtime, filemtime($this->{$fileType}->fileName), t('File modification date matches for %filename.', array(
      '%filename' => $this->{$fileType}->fileName,
    )));
  }
}