Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PHP-MySQLi-Database-Class
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
PHP-MySQLi-Database-Class
Commits
41a802eb
Commit
41a802eb
authored
Apr 21, 2014
by
Alexander Butenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve tests
parent
d0d29dd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
tests.php
tests.php
+36
-4
No files found.
tests.php
View file @
41a802eb
...
...
@@ -10,7 +10,7 @@ $tables = Array (
'login'
=>
'char(10) not null'
,
'customerId'
=>
'int(10) not null'
,
'firstName'
=>
'char(10) not null'
,
'lastName'
=>
'char(10)
not null
'
,
'lastName'
=>
'char(10)'
,
'password'
=>
'text not null'
,
'createdAt'
=>
'datetime'
,
'expires'
=>
'datetime'
,
...
...
@@ -30,7 +30,7 @@ $data = Array (
Array
(
'login'
=>
'user2'
,
'customerId'
=>
10
,
'firstName'
=>
'Mike'
,
'lastName'
=>
'B'
,
'lastName'
=>
NULL
,
'password'
=>
$db
->
func
(
'SHA1(?)'
,
Array
(
"secretpassword2+salt"
)),
'createdAt'
=>
$db
->
now
(),
'expires'
=>
$db
->
now
(
'+1Y'
),
...
...
@@ -92,7 +92,6 @@ if ($db->count != 1) {
echo
$db
->
getLastQuery
();
exit
;
}
// FIXME ADD IN and BETWEEN CHECKS
$db
->
groupBy
(
"customerId"
);
$cnt
=
$db
->
get
(
"users"
,
null
,
"customerId, count(id) as cnt"
);
...
...
@@ -109,11 +108,44 @@ $db->where ("id", 1);
$cnt
=
$db
->
update
(
"users"
,
$upData
);
$db
->
where
(
"id"
,
1
);
$db
->
getOne
(
"users"
);
$
r
=
$
db
->
getOne
(
"users"
);
if
(
$db
->
count
!=
1
)
{
echo
"Invalid users count on getOne()"
;
exit
;
}
if
(
$r
[
'password'
]
!=
'546f98b24edfdc3b9bbe0d241bd8b29783f71b32'
)
{
echo
"Invalid password were set"
.
exit
;
}
$db
->
where
(
"id"
,
Array
(
'in'
=>
Array
(
'1'
,
'2'
,
'3'
)));
$db
->
get
(
"users"
);
if
(
$db
->
count
!=
3
)
{
echo
"Invalid users count on where() with in "
;
exit
;
}
$db
->
where
(
"id"
,
Array
(
'between'
=>
Array
(
'2'
,
'3'
)));
$db
->
get
(
"users"
);
if
(
$db
->
count
!=
2
)
{
echo
"Invalid users count on where() with between"
;
exit
;
}
$db
->
where
(
"id"
,
2
);
$db
->
orWhere
(
"customerId"
,
11
);
$r
=
$db
->
get
(
"users"
);
if
(
$db
->
count
!=
2
)
{
echo
"Invalid users count on orWhere()"
;
exit
;
}
$db
->
where
(
"lastName"
,
Array
(
"<=>"
=>
NULL
));
$r
=
$db
->
get
(
"users"
);
if
(
$db
->
count
!=
1
)
{
echo
"Invalid users count on null where()"
;
exit
;
}
$db
->
delete
(
"users"
);
$db
->
get
(
"users"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment