Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yuenblue
PhpDemo
提交
91d43a00
P
PhpDemo
项目概览
yuenblue
/
PhpDemo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PhpDemo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
91d43a00
编写于
4月 06, 2024
作者:
Y
yuenblue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
aaa
上级
696edeed
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
22 deletion
+44
-22
.vscode/settings.json
.vscode/settings.json
+2
-1
README.md
README.md
+8
-0
demotp6/tests/ModelTest.php
demotp6/tests/ModelTest.php
+34
-21
未找到文件。
.vscode/settings.json
浏览文件 @
91d43a00
...
...
@@ -17,7 +17,8 @@
"phpunit.command"
:
""
,
"editor.quickSuggestions"
:
{
"comments"
:
"on"
}
},
"editor.wordSeparators"
:
"`~!@#%^&*()-=+[{]}
\\
|;:'
\"
,.<>/?"
//
"phpunit.envVars"
:
{
//
"XDEBUG_CONFIG"
:{
//
"idekey"
:
"VSCODE"
,
...
...
README.md
浏览文件 @
91d43a00
...
...
@@ -33,6 +33,14 @@ php -dxdebug.mode=debug -dxdebug.start_with_request=yes -dxdebug.client_host=lo
"comments": true,
"strings": true
}
"editor.wordSeparators": "
`
~!@#%^
&*()-=+[{]}\\|;
:'
\"
,.
<>
/?"
### snippets
"$$$$$$":{
"prefix": "ss",
"body": "$$1",
"description": "$$$$$$$"
}
## Class Model
*
@method static $this scope(string|array $scope) static 查询范围
...
...
demotp6/tests/ModelTest.php
浏览文件 @
91d43a00
...
...
@@ -7,28 +7,41 @@ use think\App;
use
function
PHPUnit\Framework\assertTrue
;
class
ModelTest
extends
TestCase
{
class
ModelTest
extends
TestCase
{
public
static
function
setUpBeforeClass
():
void
{
$http
=
(
new
App
())
->
setEnvName
(
'example'
)
->
http
;
$response
=
$http
->
run
();
}
function
tearDown
():
void
{
assertTrue
(
true
);
}
function
testEcho
()
{
public
function
testByName
()
{
$user
=
User
::
getByUsername
(
'aaa'
);
print
$user
;
}
function
testValueColumn
()
{
// $res=User::where("id",">",0)->value("email");
$res
=
User
::
where
(
"id"
,
">"
,
0
)
->
column
(
"username"
);
print
$res
;
}
function
testCreate
()
{
$user
=
new
User
();
$user
->
username
=
'aaa
'
;
$user
->
email
=
"cccc
"
;
$user
->
password
=
'bbbb
'
;
$user
->
status
=
UserState
::
Inactive
->
value
;
$user
->
username
=
'fdgdtrg
'
;
$user
->
email
=
"hyhthyth
"
;
$user
->
password
=
'wqsqwsqsw
'
;
$user
->
status
=
UserState
::
Inactive
->
value
;
$user
->
save
();
}
function
testSelect
()
{
function
testSelect
()
{
// $list=User::select();
// $list = User::order('id','asc')->select([1,2]);
// $list->hidden(['password'])
...
...
@@ -38,29 +51,29 @@ class ModelTest extends TestCase{
// });
// $list = User::select([1,2]);
$list
=
User
::
where
(
'id'
,
'>'
,
0
)
->
select
()
->
where
(
'username'
,
'aaaa'
)
->
where
(
'status'
,
'>='
,
0
);
->
where
(
'username'
,
'aaaa'
)
->
where
(
'status'
,
'>='
,
0
);
// dump($list);
$list
->
update
([
'status'
=>
UserState
::
Activated
->
value
]);
$list
->
update
([
'status'
=>
UserState
::
Activated
->
value
]);
foreach
(
$list
as
$item
)
{
// print $item->username,"\r\n";
echo
$item
->
password
,
PHP_EOL
;
echo
$item
->
password
,
PHP_EOL
;
}
}
function
testFind
()
{
$user
=
User
::
where
(
'status'
,
'>='
,
'0'
)
->
find
();
function
testFind
()
{
$user
=
User
::
where
(
'status'
,
'>='
,
'0'
)
->
find
();
// var_dump($user);
$user
->
password
=
'fff'
;
$user
->
password
=
'fff'
;
// $user->create_at=(new DateTime())->format("Y-m-d H:i:s.u");
$user
->
isAutoWriteTimestamp
(
false
)
->
save
();
// \org\util\DateTime
}
function
testDateTime
()
{
function
testDateTime
()
{
// print microtime();
$dt
=
new
DateTime
();
$res
=
$dt
->
format
(
"Y-m-d H:i:s.u"
);
$res
=
$dt
->
format
(
"Y-m-d H:i:s.u"
);
print
$res
;
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录