delete(') && str_contains($incrementalServiceSource, "'remote_delete_count' => 0") && str_contains($incrementalServiceSource, "'local_delete_count' => 0"), 'incremental medicine push must preserve EJ-only medicines and unrelated local projections' ); $assertTrue( str_contains($incrementalServiceSource, "private const DEFAULT_RUN_ID = 'zyt-incremental'") && str_contains($incrementalServiceSource, 'private static function acquireLock(') && str_contains($incrementalServiceSource, "->where('lock_token', '')") && str_contains($incrementalServiceSource, "'lock_expires_at'"), 'incremental medicine apply must use deterministic retry ids and share the EJ synchronization lease' ); $assertTrue( str_contains($incrementalServiceSource, "['source_system']") && str_contains($incrementalServiceSource, "['payload_hash']") && str_contains($incrementalServiceSource, '增量同步未改写该映射'), 'incremental medicine apply must validate response identity and never rewrite an active mapping to a different code' ); $assertTrue( str_contains($configSource, "'catalog_sync_enabled'") && str_contains($configSource, "env('EJ_PHARMACY_CATALOG_SYNC_ENABLED', false)"), 'legacy EJ catalog sync must default disabled' ); $assertTrue( str_contains($exampleEnvSource, 'EJ_PHARMACY_CATALOG_SYNC_ENABLED = false'), 'example environment must explicitly disable legacy catalog sync' ); $assertTrue( strpos($syncServiceSource, "Config::get('ej_pharmacy.catalog_sync_enabled', false)") < strpos($syncServiceSource, 'ensureStateRow()'), 'disabled catalog sync must fail before any synchronization state write' ); $assertTrue( str_contains($mappingLogicSource, "'sync_enabled'") && str_contains($mappingApiSource, 'sync_enabled: boolean'), 'mapping status must expose the legacy sync feature gate end to end' ); $assertTrue( str_contains($mappingPageSource, 'v-if="status.sync_enabled"'), 'mapping page must hide the incremental sync button when legacy sync is disabled' ); $assertTrue( str_contains($migrationSource, 'UNIQUE KEY `uk_medicine_code` (`medicine_code`)'), 'bootstrap mapping projection must reject duplicate remote medicine codes at the database boundary' ); $bootstrapServiceSource = (string) file_get_contents($bootstrapServicePath); $assertTrue( strpos($bootstrapServiceSource, "Db::name('ej_pharmacy_submission')") < strpos($bootstrapServiceSource, "'submissions' => (int) Db::name('ej_pharmacy_submission')->count()"), 'bootstrap replacement must lock reference sources before checking the zero-reference gate' ); $assertTrue( str_contains($bootstrapServiceSource, "Db::name('doctor_medicine')->where('id', '>=', 0)") && str_contains($bootstrapServiceSource, '本地药材源快照在远端导入期间发生变化'), 'bootstrap replacement must lock and revalidate the complete local medicine source snapshot' );