gitignore, product photos fixture, copy/delete in base controller test setUp/tearDown

This commit is contained in:
2025-08-19 01:13:13 -07:00
parent 493068cc1c
commit 8bdb329828
6 changed files with 43 additions and 11 deletions

View File

@@ -58,14 +58,7 @@ class ProductPhotosControllerTest extends BaseControllerTest
protected function tearDown(): void
{
unset($this->ProductPhotos);
$path = Configure::readOrFail('CakeProducts.photos.directory');
if (file_exists($path)) {
$di = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
foreach ( $ri as $file ) {
$file->isDir() ? rmdir($file->getRealPath()) : unlink($file->getRealPath());
}
}
parent::tearDown();
}