Skip to content

Commit

Permalink
fix for bcUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
nghiem-mb committed Oct 24, 2023
1 parent ce18283 commit c9fc2e7
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions plugins/baser-core/tests/TestCase/Utility/BcUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
use Cake\Core\Plugin;
use Cake\Core\Configure;
use Cake\Event\EventManager;
use Cake\Filesystem\File;
use Cake\Filesystem\Folder;
use BaserCore\Utility\BcUtil;
use BaserCore\TestSuite\BcTestCase;
use Cake\Http\Session;
Expand Down Expand Up @@ -266,14 +264,12 @@ public function testIncludePluginClass(): void
public function testClearAllCache(): void
{
// cacheファイルのバックアップ作成
$folder = new Folder();
$origin = CACHE;
$folder = new BcFolder($origin);
// $folder->create();
$backup = str_replace('cache', 'cache_backup', CACHE);
$folder->move($backup, [
'from' => $origin,
'mode' => 0777,
'schema' => Folder::OVERWRITE,
]);
// (new BcFolder($backup))->create();
$folder->move($origin, $backup);

// cache環境準備
$cacheList = ['environment' => '_bc_env_', 'persistent' => '_cake_core_', 'models' => '_cake_model_'];
Expand All @@ -297,12 +293,8 @@ public function testClearAllCache(): void
}

// cacheファイル復元
$folder->move($origin, [
'from' => $backup,
'mode' => 0777,
'schema' => Folder::OVERWRITE,
]);
$folder->chmod($origin, 0777);
$folder->move($backup, $origin);
$folder->chmod(0777);
}

/**
Expand Down Expand Up @@ -1046,15 +1038,13 @@ public function testEmptyFolder()
*/
public function testFgetcsvReg($content, $length, $d, $e, $expect, $message)
{
$csv = new File(CACHE . 'test.csv');
$csv = new BcFile(CACHE . 'test.csv');
$csv->create();
$handle = fopen($csv->getPath(), 'r');
$csv->write($content);
$csv->close();
$csv->open();

$result = BcUtil::fgetcsvReg($csv->handle, $length, $d, $e);
$result = BcUtil::fgetcsvReg($handle, $length, $d, $e);
$this->assertEquals($expect, $result, $message);

$csv->close();
}

public function fgetcsvRegDataProvider()
Expand Down

0 comments on commit c9fc2e7

Please sign in to comment.