From c7fddd8ca4fd2139d0a0ca10d9db22f1657df855 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 16 Dec 2023 00:43:57 +0000 Subject: [PATCH] Revert "Add snapshot tests to PHPUnit" This reverts commit fd9a18dd9205beab1d30649524a59c0cf0aff491. --- tests/Unit/SnapshotTest.php | 73 ------------------------------------- 1 file changed, 73 deletions(-) delete mode 100755 tests/Unit/SnapshotTest.php diff --git a/tests/Unit/SnapshotTest.php b/tests/Unit/SnapshotTest.php deleted file mode 100755 index efde332..0000000 --- a/tests/Unit/SnapshotTest.php +++ /dev/null @@ -1,73 +0,0 @@ - - */ - private static $configs = [ - 'drupal', - 'drupal-commerce-kickstart', - 'drupal-localgov', - 'fractal', - ]; - - public function testCompareFiles(): void - { - foreach (self::$configs as $config) { - $baseDir = getcwd() . "/tests/snapshots/output/{$config}"; - $generatedDir = getcwd() . "/.ignored/snapshots/output/{$config}"; - - $this->runCliTool($config); - - $baseFiles = $this->getFiles($baseDir); - - foreach ($baseFiles as $file) { - $this->assertFileEquals( - expected: $baseDir . '/' . $file, - actual: $generatedDir . '/' . $file, - message: "Files do not match: {$file}", - ); - } - } - } - - private function runCliTool(string $config): void - { - $configFilePath = getcwd() . "/tests/snapshots/configs/{$config}.yaml"; - - $cliCommand = sprintf( - "%s app:generate --config-file %s --output-dir %s", - getcwd() . '/bin/build-configs', - $configFilePath, - getcwd() . "/.ignored/snapshots/output/{$config}", - ); - - exec($cliCommand); - } - - /** - * @return array - */ - private function getFiles(string $directory): array - { - $files = []; - - $finder = new Finder(); - $finder->in($directory)->files(); - - foreach ($finder as $file) { - $files[] = $file->getRelativePathname(); - } - - return $files; - } -}