ServicesSpycLibraryTests.test in Services 7.3
File
tests/unit/ServicesSpycLibraryTests.test
View source
<?php
class ServicesSpycLibraryTests extends DrupalUnitTestCase {
public static function getInfo() {
return array(
'name' => 'Spyc Library',
'description' => 'Test if we can download Spyc library.',
'group' => 'Services',
);
}
public function testMakeFileLinkValid() {
$makefile_path = drupal_get_path('module', 'services') . '/services.make.example';
$makefile_content = file_get_contents($makefile_path);
$matches = array();
preg_match('/libraries\\[spyc\\]\\[download\\]\\[url\\] = (.*)/', $makefile_content, $matches);
$spyc_library_url = $matches[1];
$spyc_library_content = file_get_contents($spyc_library_url);
$search_keywords = array(
'<?php',
'Spyc',
'YAML',
);
$spyc_library_valid = TRUE;
foreach ($search_keywords as $keyword) {
$spyc_library_valid = $spyc_library_valid && strpos($spyc_library_content, $keyword) !== FALSE;
}
$this
->assertTrue($spyc_library_valid, 'Spyc library can be downloaded from make file.');
}
}