directory = ReportCSVExporter::get_reports_directory(); $this->filesystem = $wp_filesystem; } /** * Test that directory is created. */ public function test_directory_creation() { $this->filesystem->delete( $this->directory ); ReportCSVExporter::maybe_create_directory(); $this->assertDirectoryExists( $this->directory ); } /** * Test that files are created to prevent indexing. */ public function test_indexing_files_creation() { $this->filesystem->delete( $this->directory . 'index.html' ); $this->filesystem->delete( $this->directory . '.htaccess' ); ReportCSVExporter::maybe_create_directory(); $this->assertFileExists( $this->directory . 'index.html' ); $this->assertFileExists( $this->directory . '.htaccess' ); } }