Ad hoc PHP stdin smoke, isolated temporary SQLite; no external transport invoked
Exit: 0



  [think\exception\ThrowableError]
  Fatal error: Class 'PHPUnit\Framework\TestCase' not found



Exception trace:
 () at /Users/wiscourper/Documents/workspace/zhct/zhctproject/store/tests/apifox/Support/ControllerContractTestCase.php:7
 require_once() at /Users/wiscourper/Documents/workspace/zhct/zhctproject/store/tests/bootstrap.php:32
 require() at Standard input code:2



Reproducible script:
<?php
require 'tests/bootstrap.php';
$p=tempnam(sys_get_temp_dir(),'tchef_old_');
try {
\think\Config::set(['type'=>'sqlite','database'=>$p,'prefix'=>'ydy_','debug'=>true,'resultset_type'=>'array','auto_timestamp'=>false,'charset'=>'utf8'],'database');
\think\Db::clear();
\app\cores\BaseModel::$storeId=10001;
\think\Db::execute('CREATE TABLE ydy_config (config_key TEXT, status INTEGER, config_value TEXT)');
\think\Db::execute('CREATE TABLE ydy_foods_composition (id INTEGER PRIMARY KEY, name TEXT, edible_part REAL, category INTEGER, category_two INTEGER, energy REAL, carbohydrate REAL, protein REAL, fat REAL, foods_status INTEGER, gas_food INTEGER, store_id INTEGER, is_delete INTEGER DEFAULT 0)');
\think\Db::execute('CREATE TABLE ydy_dish (id INTEGER PRIMARY KEY, foods_id INTEGER, is_delete INTEGER DEFAULT 0, store_id INTEGER)');
$data=['id'=>1,'name'=>'old-food','edible_part'=>100,'category'=>1,'category_two'=>1,'energy'=>100,'carbohydrate'=>20,'protein'=>2,'fat'=>1,'foods_status'=>1,'gas_food'=>0,'store_id'=>10001];
\think\Db::name('foods_composition')->insert($data);
unset($data['id']);$data['name']='edited-food';$data['condiment_state']=1;
$s=new \app\store\service\dishes\Foods();
if(!$s->edit(1,$data))throw new RuntimeException('edit false');
$row=\think\Db::name('foods_composition')->where('id',1)->find();
if($row['name']!=='edited-food'||array_key_exists('condiment_state',$row))throw new RuntimeException('old-schema edit assertion');
echo "PASS old schema edit via real service; no new field/tables\n";
if(!$s->setDelete(1))throw new RuntimeException('delete false');
if((int)\think\Db::name('foods_composition')->where('id',1)->value('is_delete')!==1)throw new RuntimeException('delete assertion');
echo "PASS old schema soft-delete via real service\n";
} catch(\Throwable $e){echo get_class($e).': '.$e->getMessage()."\n".$e->getTraceAsString()."\n";exit(1);} finally {\think\Db::clear();unlink($p);}

Retry load PHPUnit autoload before bootstrap
Exit: 255
PHP Fatal error:  Cannot declare class Composer\Autoload\ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd, because the name is already in use in /Users/wiscourper/Documents/workspace/zhct/zhctproject/store/vendor/composer/autoload_static.php on line 7

Fatal error: Cannot declare class Composer\Autoload\ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd, because the name is already in use in /Users/wiscourper/Documents/workspace/zhct/zhctproject/store/vendor/composer/autoload_static.php on line 7

Reproducible script:
<?php
require 'vendor/autoload.php';
require 'tests/bootstrap.php';
$p=tempnam(sys_get_temp_dir(),'tchef_old_');
try {
\think\Config::set(['type'=>'sqlite','database'=>$p,'prefix'=>'ydy_','debug'=>true,'resultset_type'=>'array','auto_timestamp'=>false,'charset'=>'utf8'],'database');
\think\Db::clear();
\app\cores\BaseModel::$storeId=10001;
\think\Db::execute('CREATE TABLE ydy_config (config_key TEXT, status INTEGER, config_value TEXT)');
\think\Db::execute('CREATE TABLE ydy_foods_composition (id INTEGER PRIMARY KEY, name TEXT, edible_part REAL, category INTEGER, category_two INTEGER, energy REAL, carbohydrate REAL, protein REAL, fat REAL, foods_status INTEGER, gas_food INTEGER, store_id INTEGER, is_delete INTEGER DEFAULT 0)');
\think\Db::execute('CREATE TABLE ydy_dish (id INTEGER PRIMARY KEY, foods_id INTEGER, is_delete INTEGER DEFAULT 0, store_id INTEGER)');
$data=['id'=>1,'name'=>'old-food','edible_part'=>100,'category'=>1,'category_two'=>1,'energy'=>100,'carbohydrate'=>20,'protein'=>2,'fat'=>1,'foods_status'=>1,'gas_food'=>0,'store_id'=>10001];
\think\Db::name('foods_composition')->insert($data);
unset($data['id']);$data['name']='edited-food';$data['condiment_state']=1;
$s=new \app\store\service\dishes\Foods();
if(!$s->edit(1,$data))throw new RuntimeException('edit false');
$row=\think\Db::name('foods_composition')->where('id',1)->find();
if($row['name']!=='edited-food'||array_key_exists('condiment_state',$row))throw new RuntimeException('old-schema edit assertion');
echo "PASS old schema edit via real service; no new field/tables\n";
if(!$s->setDelete(1))throw new RuntimeException('delete false');
if((int)\think\Db::name('foods_composition')->where('id',1)->value('is_delete')!==1)throw new RuntimeException('delete assertion');
echo "PASS old schema soft-delete via real service\n";
} catch(\Throwable $e){echo get_class($e).': '.$e->getMessage()."\n".$e->getTraceAsString()."\n";exit(1);} finally {\think\Db::clear();unlink($p);}

Retry via PHPUnit temporary test file (framework/bootstrap ordering)
Exit: 0
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)PASS old schema edit via real service; no new field/tables
PASS old schema soft-delete via real service


Time: 36 ms, Memory: 12.00 MB

OK (1 test, 1 assertion)

Final reproducible temporary test:
<?php
class IndependentFoodOldSchemaTest extends \PHPUnit\Framework\TestCase {public function testRealEditAndDelete(){
$p=tempnam(sys_get_temp_dir(),'tchef_old_');
try {
\think\Config::set(['type'=>'sqlite','database'=>$p,'prefix'=>'ydy_','debug'=>true,'resultset_type'=>'array','auto_timestamp'=>false,'charset'=>'utf8'],'database');
\think\Db::clear();
\app\cores\BaseModel::$storeId=10001;
\think\Db::execute('CREATE TABLE ydy_config (config_key TEXT, status INTEGER, config_value TEXT)');
\think\Db::execute('CREATE TABLE ydy_foods_composition (id INTEGER PRIMARY KEY, name TEXT, edible_part REAL, category INTEGER, category_two INTEGER, energy REAL, carbohydrate REAL, protein REAL, fat REAL, foods_status INTEGER, gas_food INTEGER, store_id INTEGER, is_delete INTEGER DEFAULT 0)');
\think\Db::execute('CREATE TABLE ydy_dish (id INTEGER PRIMARY KEY, foods_id INTEGER, is_delete INTEGER DEFAULT 0, store_id INTEGER)');
$data=['id'=>1,'name'=>'old-food','edible_part'=>100,'category'=>1,'category_two'=>1,'energy'=>100,'carbohydrate'=>20,'protein'=>2,'fat'=>1,'foods_status'=>1,'gas_food'=>0,'store_id'=>10001];
\think\Db::name('foods_composition')->insert($data);
unset($data['id']);$data['name']='edited-food';$data['condiment_state']=1;
$s=new \app\store\service\dishes\Foods();
if(!$s->edit(1,$data))throw new RuntimeException('edit false');
$row=\think\Db::name('foods_composition')->where('id',1)->find();
if($row['name']!=='edited-food'||array_key_exists('condiment_state',$row))throw new RuntimeException('old-schema edit assertion');
echo "PASS old schema edit via real service; no new field/tables\n";
if(!$s->setDelete(1))throw new RuntimeException('delete false');
if((int)\think\Db::name('foods_composition')->where('id',1)->value('is_delete')!==1)throw new RuntimeException('delete assertion');
echo "PASS old schema soft-delete via real service\n";
} catch(\Throwable $e){echo get_class($e).': '.$e->getMessage()."\n".$e->getTraceAsString()."\n";throw $e;} finally {\think\Db::clear();unlink($p);}
$this->assertTrue(true);}}
