function RegistryParseFilesTestCase::testRegistryParseFiles

testRegistryParseFiles

File

modules/simpletest/tests/registry.test, line 105

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 hash.
        $hash = db_query('SELECT hash FROM {registry_file} WHERE filename = :filename', array(
            ':filename' => $this->{$fileType}->fileName,
        ))
            ->fetchField();
        $this->assertTrue(hash('sha256', $this->{$fileType}->contents) == $hash, t('sha-256 for "@filename" matched.' . $fileType . $hash, array(
            '@filename' => $this->{$fileType}->fileName,
        )));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.