public function Thunder2UpdateTest::applyPatch in Thunder 8.2
Applies provided patch at provided location.
Parameters
string $patch: Url to patch.
string $location: File system location.
1 call to Thunder2UpdateTest::applyPatch()
- Thunder2UpdateTest::setUp in tests/
src/ Functional/ Thunder2UpdateTest.php - Overrides WebTestBase::setUp() for update testing.
File
- tests/
src/ Functional/ Thunder2UpdateTest.php, line 86
Class
- Thunder2UpdateTest
- Tests Thunder updates from 2.0 to current.
Namespace
Drupal\Tests\thunder\FunctionalCode
public function applyPatch($patch, $location) {
$old_cwd = getcwd();
chdir($location);
exec('/usr/bin/curl -s ' . escapeshellarg($patch) . ' | patch -p1', $output, $retcode);
chdir($old_cwd);
if ($retcode != 0) {
throw new \Exception("Patch {$patch} failed to apply.");
}
}