comparison core/tests/Drupal/Tests/Component/DrupalComponentTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
28 public function testNoCoreInComponentTests() { 28 public function testNoCoreInComponentTests() {
29 $component_path = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))) . '/tests/Drupal/Tests/Component'; 29 $component_path = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))) . '/tests/Drupal/Tests/Component';
30 foreach ($this->findPhpClasses($component_path) as $class) { 30 foreach ($this->findPhpClasses($component_path) as $class) {
31 $this->assertNoCoreUsage($class); 31 $this->assertNoCoreUsage($class);
32 } 32 }
33 }
34
35 /**
36 * Tests LICENSE.txt is present and has the correct content.
37 *
38 * @param $component_path
39 * The path to the component.
40 * @dataProvider \Drupal\Tests\Component\DrupalComponentTest::getComponents
41 */
42 public function testComponentLicence($component_path) {
43 $this->assertFileExists($component_path . DIRECTORY_SEPARATOR . 'LICENSE.txt');
44 $this->assertSame('e84dac1d9fbb5a4a69e38654ce644cea769aa76b', hash_file('sha1', $component_path . DIRECTORY_SEPARATOR . 'LICENSE.txt'));
45 }
46
47 /**
48 * Data provider.
49 *
50 * @return array
51 */
52 public function getComponents() {
53 $root_component_path = dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))) . '/lib/Drupal/Component';
54 $component_paths = [];
55 foreach (new \DirectoryIterator($root_component_path) as $file) {
56 if ($file->isDir() && !$file->isDot()) {
57 $component_paths[$file->getBasename()] = [$file->getPathname()];
58 }
59 }
60 return $component_paths;
33 } 61 }
34 62
35 /** 63 /**
36 * Searches a directory recursively for PHP classes. 64 * Searches a directory recursively for PHP classes.
37 * 65 *