|
@@ -87,9 +87,14 @@ class TestAddData extends TestCase
|
|
|
|
|
|
private function addFile($file)
|
|
|
{
|
|
|
+ $filename = BASE_DATA_PATH . "/cards/{$file}";
|
|
|
+ if(!file_exists($filename)) {
|
|
|
+ Log::record("{$file} not exists.",Log::ERR);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
$mod_card = Model('card_key');
|
|
|
|
|
|
- $filename = BASE_DATA_PATH . "/cards/{$file}";
|
|
|
$fileType = PHPExcel_IOFactory::identify($filename);
|
|
|
$objReader = PHPExcel_IOFactory::createReader($fileType);
|
|
|
$objPHPExcel = $objReader->load($filename);
|
|
@@ -112,11 +117,12 @@ class TestAddData extends TestCase
|
|
|
}
|
|
|
else {
|
|
|
Log::record("{$filename} sheet {$title} name type error.",Log::ERR);
|
|
|
- return ;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
if($amount <= 0) {
|
|
|
Log::record("{$filename} sheet {$title} name amount error.",Log::ERR);
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
foreach ($sheet->getRowIterator() as $row)
|
|
@@ -145,6 +151,7 @@ class TestAddData extends TestCase
|
|
|
}
|
|
|
}
|
|
|
Log::record("{$file} end....",Log::DEBUG);
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
private function check_cardno($card_no)
|
|
@@ -335,4 +342,4 @@ class TestAddData extends TestCase
|
|
|
|
|
|
//docker-compose -f ./docker-compose-dev.yml run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestAddData::test20200821_addCard)( .*)?$/" --test-suffix TestAddData.php /var/www/html/test
|
|
|
|
|
|
-//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestAddData::test20200906_addCard)( .*)?$/" --test-suffix TestAddData.php /var/www/html/test
|
|
|
+//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestAddData::test20200906_1_addCard)( .*)?$/" --test-suffix TestAddData.php /var/www/html/test
|