composer update + load more dev dependencies for code quality, checkstyle fix
This commit is contained in:
@@ -14,55 +14,52 @@ use RecursiveIteratorIterator;
|
||||
*
|
||||
* Used to make logging in easier and to handle folder structure for product images
|
||||
*/
|
||||
class BaseControllerTest extends TestCase
|
||||
{
|
||||
use IntegrationTestTrait;
|
||||
class BaseControllerTest extends TestCase {
|
||||
|
||||
public function loginUserByRole(string $role = 'admin'): void
|
||||
{
|
||||
$this->session(['Auth.User.id' => 1]);
|
||||
$this->session(['Auth.id' => 1]);
|
||||
}
|
||||
use IntegrationTestTrait;
|
||||
|
||||
/**
|
||||
public function loginUserByRole(string $role = 'admin'): void {
|
||||
$this->session(['Auth.User.id' => 1]);
|
||||
$this->session(['Auth.id' => 1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testTest()
|
||||
{
|
||||
$this->assertEquals(1, 1);
|
||||
}
|
||||
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 . 'uploads' . 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, 0775, true);
|
||||
}
|
||||
copy($toCopy, $newName);
|
||||
}
|
||||
}
|
||||
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 . 'uploads' . 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, 0775, true);
|
||||
}
|
||||
copy($toCopy, $newName);
|
||||
}
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown(); // TODO: Change the autogenerated stub
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user