Skip to content

Commit 851dcfe

Browse files
committed
More tests
1 parent 76565db commit 851dcfe

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

tests/dbObjectTests.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,28 @@ function createTable ($name, $data) {
222222
exit;
223223
}
224224

225+
if (!user::byId(1) instanceof user)
226+
echo "wrong return type1";
227+
228+
if (!is_array (user::ArrayBuilder()->byId(1)))
229+
echo "wrong return type2";
230+
231+
if (!is_array (product::join('user')->orderBy('products.id', 'desc')->get(2)))
232+
echo "wrong return type2";
233+
234+
if (!is_array (product::orderBy('products.id', 'desc')->join('user')->get(2)))
235+
echo "wrong return type2";
236+
237+
$u = new user;
238+
if (!$u->byId(1) instanceof user)
239+
echo "wrong return type2";
240+
241+
$p = new product;
242+
if (!is_array ($p->join('user')->orderBy('products.id', 'desc')->get(2)))
243+
echo "wrong return type2";
244+
245+
if (!is_array ($p->orderBy('products.id', 'desc')->join('user')->get(2)))
246+
echo "wrong return type2";
247+
225248
echo "All done";
226249
?>

tests/models/product.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
/**
55
* To make IDEs autocomplete happy
66
*
7-
* @property string id
8-
* @property string userid
9-
* @property string customerId
7+
* @property int id
8+
* @property int userid
9+
* @property int customerId
1010
* @property string productName
1111
*/
1212
class product extends dbObject {

tests/models/user.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
/**
55
* To make IDEs autocomplete happy
66
*
7-
* @property string id
7+
* @property int id
88
* @property string login
9-
* @property string active
9+
* @property bool active
1010
* @property string customerId
1111
* @property string firstName
1212
* @property string lastName
1313
* @property string password
1414
* @property string createdAt
1515
* @property string updatedAt
1616
* @property string expires
17-
* @property string loginCount
17+
* @property int loginCount
1818
*/
1919
class user extends dbObject {
2020
protected $dbTable = "users";

0 commit comments

Comments
 (0)