You are here

public function XMLSitemapUnitTest::testUninstallDeleteDirectory in XML sitemap 7.2

Test that uninstalling the module correctly deletes the directory.

File

./xmlsitemap.test, line 857
Unit tests for the xmlsitemap.

Class

XMLSitemapUnitTest
XML Sitemap UnitTest.

Code

public function testUninstallDeleteDirectory() {
  $directory = 'public://test';
  file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);

  // Update the directory path to a different value.
  variable_set('xmlsitemap_path', 'test');
  drupal_static_reset('xmlsitemap_get_directory');

  // Test that running uninstall removes the correct directory (test) and not the default (xmlsitemap)
  drupal_uninstall_modules(array(
    'xmlsitemap',
  ));
  $this
    ->assertFalse(is_dir('public://test'));
  $this
    ->assertTrue(is_dir('public://xmlsitemap'));
}