znt/module/screen/test/model/buildgroup.php

48 lines
1.9 KiB
PHP
Raw Permalink Normal View History

#!/usr/bin/env php
<?php
/**
title=测试 screenModel::buildGroup();
timeout=0
cid=18211
- 步骤1空component验证添加了默认styles.hueRotate第styles条的hueRotate属性 @0
- 步骤2已有styles验证保持不变属性styles @customStyles
- 步骤3已有status验证保持不变属性status @customStatus
- 步骤4已有request验证保持不变属性request @customRequest
- 步骤5已有events验证保持不变属性events @customEvents
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
// 2. 用户登录(选择合适角色)
su('admin');
// 3. 创建测试实例(变量名与模块名一致)
$screenTest = new screenModelTest();
// 4. 准备测试数据
$emptyComponent = new stdclass();
$componentWithStyles = new stdclass();
$componentWithStyles->styles = 'customStyles';
$componentWithStatus = new stdclass();
$componentWithStatus->status = 'customStatus';
$componentWithRequest = new stdclass();
$componentWithRequest->request = 'customRequest';
$componentWithEvents = new stdclass();
$componentWithEvents->events = 'customEvents';
// 5. 强制要求必须包含至少5个测试步骤
r($screenTest->buildGroupTest($emptyComponent)) && p('styles:hueRotate') && e('0'); // 步骤1空component验证添加了默认styles.hueRotate
r($screenTest->buildGroupTest($componentWithStyles)) && p('styles') && e('customStyles'); // 步骤2已有styles验证保持不变
r($screenTest->buildGroupTest($componentWithStatus)) && p('status') && e('customStatus'); // 步骤3已有status验证保持不变
r($screenTest->buildGroupTest($componentWithRequest)) && p('request') && e('customRequest'); // 步骤4已有request验证保持不变
r($screenTest->buildGroupTest($componentWithEvents)) && p('events') && e('customEvents'); // 步骤5已有events验证保持不变