- Added a test framework to Drupal along with a first batch of tests for
Drupal core! This is an important milestone for the project so enable
the module and check it out ... :)
Thanks to Rok Žlender, Károly Négyesi, Jimmy Berry, Kevin Bridges, Charlie
Gordon, Douglas Hubler, Miglius Alaburda, Andy Kirkham, Dimitri13, Kieran
Lal, Moshe Weitzman, and the many other people that helped with testing
over the past years and that drove this home.
It all works but it is still rough around the edges (i.e. documentation
is still being written, the coding style is not 100% yet, a number of
tests still fail) but we spent the entire weekend working on it in Paris
and made a ton of progress. The best way to help and to get up to speed,
is to start writing and contributing some tests ... as well as fixing
some of the failures.
For those willing to help with improving the test framework, here are
some next steps and issues to resolve:
- How to best approach unit tests and mock functions?
- How to test drupal_mail() and drupal_http_request()?
- How to improve the admin UI so we have a nice progress bar?
- How best to do code coverage?
- See http://g.d.o/node/10099 for more ...
2008-04-20 18:24:07 +00:00
|
|
|
<?php
|
|
|
|
|
2009-05-13 19:42:18 +00:00
|
|
|
/**
|
|
|
|
* @file
|
2020-02-12 09:23:09 +00:00
|
|
|
* Uninstall functions for the simpletest module.
|
2009-05-13 19:42:18 +00:00
|
|
|
*/
|
|
|
|
|
2020-02-12 09:23:09 +00:00
|
|
|
use Drupal\Core\Database\Database;
|
Issue #2244513 by kim.pepper, phenaproxima, 20th, andrei.dincu, beejeebus, Berdir, alexpott, jibran, andypost, larowlan, Chadwick Wood, acbramley, Wim Leers, sun, xjm, YesCT, chx, tim.plunkett: Move the unmanaged file APIs to the file_system service (file.inc)
2019-02-23 22:35:15 +00:00
|
|
|
use Drupal\Core\File\Exception\FileException;
|
2020-02-19 00:57:38 +00:00
|
|
|
use Drupal\Core\Test\EnvironmentCleaner;
|
2019-08-22 04:02:01 +00:00
|
|
|
use Drupal\Core\Test\TestDatabase;
|
2020-02-12 09:23:09 +00:00
|
|
|
use Symfony\Component\Console\Output\NullOutput;
|
2008-06-24 21:51:03 +00:00
|
|
|
|
2010-10-15 23:40:21 +00:00
|
|
|
/**
|
|
|
|
* Implements hook_schema().
|
|
|
|
*/
|
2008-06-24 21:51:03 +00:00
|
|
|
function simpletest_schema() {
|
2019-08-22 04:02:01 +00:00
|
|
|
return TestDatabase::testingSchema();
|
2008-06-24 21:51:03 +00:00
|
|
|
}
|
2010-11-12 03:06:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_uninstall().
|
|
|
|
*/
|
|
|
|
function simpletest_uninstall() {
|
2014-02-10 17:31:31 +00:00
|
|
|
// Do not clean the environment in case the Simpletest module is uninstalled
|
2020-02-12 09:23:09 +00:00
|
|
|
// in a (recursive) test for itself, since EnvironmentCleaner would also
|
|
|
|
// delete the test site of the parent test process.
|
2014-04-04 13:49:13 +00:00
|
|
|
if (!drupal_valid_test_ua()) {
|
2020-02-12 09:23:09 +00:00
|
|
|
// Clean up left-over tables and directories.
|
|
|
|
$cleaner = new EnvironmentCleaner(
|
|
|
|
DRUPAL_ROOT,
|
|
|
|
Database::getConnection(),
|
|
|
|
TestDatabase::getConnection(),
|
|
|
|
new NullOutput(),
|
|
|
|
\Drupal::service('file_system')
|
|
|
|
);
|
|
|
|
try {
|
|
|
|
$cleaner->cleanEnvironment();
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
// Ignore.
|
|
|
|
}
|
2014-02-10 17:31:31 +00:00
|
|
|
}
|
2020-02-12 09:23:09 +00:00
|
|
|
|
2014-02-10 17:31:31 +00:00
|
|
|
// Delete verbose test output and any other testing framework files.
|
Issue #2244513 by kim.pepper, phenaproxima, 20th, andrei.dincu, beejeebus, Berdir, alexpott, jibran, andypost, larowlan, Chadwick Wood, acbramley, Wim Leers, sun, xjm, YesCT, chx, tim.plunkett: Move the unmanaged file APIs to the file_system service (file.inc)
2019-02-23 22:35:15 +00:00
|
|
|
try {
|
|
|
|
\Drupal::service('file_system')->deleteRecursive('public://simpletest');
|
|
|
|
}
|
|
|
|
catch (FileException $e) {
|
|
|
|
// Ignore.
|
|
|
|
}
|
2010-11-12 03:06:52 +00:00
|
|
|
}
|