znt/module/file/test/model/setwebpath.php

27 lines
1 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试 fileModel::setWebPath();
timeout=0
cid=16536
- 测试默认公司ID1的webPath设置 @/data/upload/1/
- 测试自定义公司ID5的webPath设置 @/data/upload/5/
- 测试公司ID为0的边界情况 @/data/upload/0/
- 测试公司ID未设置时的默认值 @/data/upload/1/
- 测试webRoot为空字符串的情况 @data/upload/1/
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$file = new fileModelTest();
r($file->setWebPathTest()) && p() && e('/data/upload/1/'); // 测试默认公司ID1的webPath设置
r($file->setWebPathTest(5)) && p() && e('/data/upload/5/'); // 测试自定义公司ID5的webPath设置
r($file->setWebPathTest(0)) && p() && e('/data/upload/0/'); // 测试公司ID为0的边界情况
r($file->setWebPathTest(null)) && p() && e('/data/upload/1/'); // 测试公司ID未设置时的默认值
r($file->setWebPathTest(1, '')) && p() && e('data/upload/1/'); // 测试webRoot为空字符串的情况