@@ -39,14 +39,12 @@ public function testCountType()
39
39
$ book ->sharedPage = R::dispense ( 'page ' , 10 );
40
40
R::store ( $ book );
41
41
asrt ( R::count ('bookPage ' ), 10 );
42
-
43
42
try {
44
43
R::count ( 'WrongTypeName ' );
45
44
fail ();
46
45
} catch ( RedException $ ex ) {
47
46
pass ();
48
47
}
49
-
50
48
try {
51
49
R::count ( 'wrong_type_name ' );
52
50
fail ();
@@ -63,62 +61,38 @@ public function testCountType()
63
61
public function testCountAndWipe ()
64
62
{
65
63
testpack ( "Test count and wipe " );
66
-
67
64
$ page = R::dispense ( "page " );
68
-
69
65
$ page ->name = "ABC " ;
70
-
71
66
R::store ( $ page );
72
-
73
67
$ n1 = R::count ( "page " );
74
-
75
68
$ page = R::dispense ( "page " );
76
-
77
69
$ page ->name = "DEF " ;
78
-
79
70
R::store ( $ page );
80
-
81
71
$ n2 = R::count ( "page " );
82
-
83
72
asrt ( $ n1 + 1 , $ n2 );
84
-
85
73
R::wipe ( "page " );
86
-
87
74
asrt ( R::count ( "page " ), 0 );
88
75
asrt ( R::getRedBean ()->count ( "page " ), 0 );
89
76
asrt ( R::getRedBean ()->count ( "kazoo " ), 0 ); // non existing table
90
-
91
77
R::freeze ( TRUE );
92
-
93
78
try {
94
79
asrt ( R::getRedBean ()->count ( "kazoo " ), 0 ); // non existing table
95
80
fail ();
96
81
} catch ( \Exception $ e ) {
97
82
pass ();
98
83
}
99
-
100
84
R::freeze ( FALSE );
101
-
102
85
$ page = R::dispense ( 'page ' );
103
-
104
86
$ page ->name = 'foo ' ;
105
-
106
87
R::store ( $ page );
107
-
108
88
$ page = R::dispense ( 'page ' );
109
-
110
89
$ page ->name = 'bar ' ;
111
-
112
90
R::store ( $ page );
113
-
114
91
asrt ( R::count ( 'page ' , ' name = ? ' , array ( 'foo ' ) ), 1 );
115
-
116
92
// Now count something that does not exist, this should return 0. (just be polite)
117
93
asrt ( R::count ( 'teapot ' , ' name = ? ' , array ( 'flying ' ) ), 0 );
118
94
asrt ( R::count ( 'teapot ' ), 0 );
119
-
120
95
$ currentDriver = $ this ->currentlyActiveDriverID ;
121
-
122
96
// Some drivers don't support that many error codes.
123
97
if ( $ currentDriver === 'mysql ' || $ currentDriver === 'postgres ' ) {
124
98
try {
@@ -130,8 +104,13 @@ public function testCountAndWipe()
130
104
}
131
105
}
132
106
133
- public function testCountShared () {
134
-
107
+ /**
108
+ * Can we count the number of shared beans?
109
+ *
110
+ * @return void
111
+ */
112
+ public function testCountShared ()
113
+ {
135
114
R::nuke ();
136
115
$ book = R::dispense ( 'book ' );
137
116
$ book ->sharedPageList = R::dispense ( 'page ' , 5 );
@@ -157,6 +136,8 @@ public function testCountShared() {
157
136
158
137
/**
159
138
* Test $bean->countOwn($type);
139
+ *
140
+ * @return void
160
141
*/
161
142
public function testCountOwn ()
162
143
{
@@ -198,6 +179,8 @@ public function testCountOwn()
198
179
199
180
/**
200
181
* Test $bean->withCondition( ... )->countOwn( $type );
182
+ *
183
+ * @return void
201
184
*/
202
185
public function testCountWithCondition ()
203
186
{
0 commit comments