66 行
3.2 KiB
PHP
66 行
3.2 KiB
PHP
<?php
|
||
/**
|
||
* 三大服务独立页改版与内容规范测试 (PHP TDD 模式)
|
||
* 验证:软件开发、APP与小程序定制、智能体开发三大专属独立页的完整性
|
||
*/
|
||
|
||
class DedicatedServicePagesTest
|
||
{
|
||
private $passed = 0;
|
||
private $failed = 0;
|
||
|
||
public function run()
|
||
{
|
||
echo "=== 开始执行三大核心服务独立页设计规范测试 (TDD) ===\n";
|
||
|
||
$baseDir = dirname(__DIR__);
|
||
$softwareFile = $baseDir . '/addons/official/view/web/official_product/service_software.html';
|
||
$appFile = $baseDir . '/addons/official/view/web/official_product/service_app.html';
|
||
$agentFile = $baseDir . '/addons/official/view/web/official_product/service_agent.html';
|
||
$navFile = $baseDir . '/addons/official/view/web/official_common/pc/nav.html';
|
||
|
||
$this->assert(file_exists($softwareFile), "软件开发独立页文件必须存在");
|
||
$this->assert(file_exists($appFile), "APP与小程序定制独立页文件必须存在");
|
||
$this->assert(file_exists($agentFile), "智能体开发独立页文件必须存在");
|
||
|
||
if (file_exists($softwareFile)) {
|
||
$softwareContent = file_get_contents($softwareFile);
|
||
$this->assert(strpos($softwareContent, '纳海川') !== false, "软件开发独立页包含品牌【纳海川】");
|
||
$this->assert(strpos($softwareContent, '微服务') !== false && strpos($softwareContent, '中台') !== false, "软件开发独立页包含微服务与中台");
|
||
}
|
||
|
||
if (file_exists($appFile)) {
|
||
$appContent = file_get_contents($appFile);
|
||
$this->assert(strpos($appContent, '纳海川') !== false, "APP小程序独立页包含品牌【纳海川】");
|
||
$this->assert(strpos($appContent, '60fps') !== false || strpos($appContent, '蓝牙') !== false, "APP小程序独立页包含真实移动工程指标");
|
||
}
|
||
|
||
if (file_exists($agentFile)) {
|
||
$agentContent = file_get_contents($agentFile);
|
||
$this->assert(strpos($agentContent, '纳海川') !== false, "智能体独立页包含品牌【纳海川】");
|
||
$this->assert(strpos($agentContent, 'RAG') !== false || strpos($agentContent, '物理隔离') !== false, "智能体独立页包含RAG与物理隔离保障");
|
||
}
|
||
|
||
if (file_exists($navFile)) {
|
||
$navContent = file_get_contents($navFile);
|
||
$this->assert(strpos($navContent, 'service_software') !== false || strpos($navContent, 'service=software') !== false, "导航卡片支持跳转软件开发独立页");
|
||
$this->assert(strpos($navContent, 'service_app') !== false || strpos($navContent, 'service=app') !== false, "导航卡片支持跳转APP小程序独立页");
|
||
$this->assert(strpos($navContent, 'service_agent') !== false || strpos($navContent, 'service=agent') !== false, "导航卡片支持跳转智能体独立页");
|
||
}
|
||
|
||
echo "\n测试结果: {$this->passed} 通过, {$this->failed} 失败\n";
|
||
return $this->failed === 0;
|
||
}
|
||
|
||
private function assert($condition, $message)
|
||
{
|
||
if ($condition) {
|
||
echo " [PASS] {$message}\n";
|
||
$this->passed++;
|
||
} else {
|
||
echo " [FAIL] {$message}\n";
|
||
$this->failed++;
|
||
}
|
||
}
|
||
}
|