session(['Auth.User.id' => 1]); $this->session(['Auth.id' => 1]); } /** * @return void */ public function testTest() { $this->assertEquals(1, 1); } /** * setUp method * * @return void */ protected function setUp(): void { parent::setUp(); $toCopy = PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS . 'images' . DS . '2c386086-f4c5-4093-bea5-ee9c29479f58.png'; $productsFolder = PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS . 'images' . DS . 'products' . DS . 'cfc98a9a-29b2-44c8-b587-8156adc05317'; $newName = $productsFolder . DS . '2c386086-f4c5-4093-bea5-ee9c29479f58.png'; if (file_exists($toCopy)) { if (!file_exists($productsFolder)) { mkdir($productsFolder); } copy($toCopy, $newName); } } protected function tearDown(): void { parent::tearDown(); // TODO: Change the autogenerated stub $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()); } } } }