Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 381a375

Browse files
committedJul 18, 2024··
fix
1 parent c2ae2f4 commit 381a375

6 files changed

+868
-2
lines changed
 

Diff for: ‎tests/_support/MySqlIntegrationTester.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Vjik\Codeception\DatabasePopulator\Tests;
6+
7+
/**
8+
* Inherited Methods
9+
* @method void wantTo($text)
10+
* @method void wantToTest($text)
11+
* @method void execute($callable)
12+
* @method void expectTo($prediction)
13+
* @method void expect($prediction)
14+
* @method void amGoingTo($argumentation)
15+
* @method void am($role)
16+
* @method void lookForwardTo($achieveValue)
17+
* @method void comment($description)
18+
* @method void pause($vars = [])
19+
*
20+
* @SuppressWarnings(PHPMD)
21+
*/
22+
class MySqlIntegrationTester extends \Codeception\Actor
23+
{
24+
use _generated\MySqlIntegrationTesterActions;
25+
26+
/**
27+
* Define custom actions here
28+
*/
29+
}

Diff for: ‎tests/_support/MySqlPreloadTester.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Vjik\Codeception\DatabasePopulator\Tests;
6+
7+
/**
8+
* Inherited Methods
9+
* @method void wantTo($text)
10+
* @method void wantToTest($text)
11+
* @method void execute($callable)
12+
* @method void expectTo($prediction)
13+
* @method void expect($prediction)
14+
* @method void amGoingTo($argumentation)
15+
* @method void am($role)
16+
* @method void lookForwardTo($achieveValue)
17+
* @method void comment($description)
18+
* @method void pause($vars = [])
19+
*
20+
* @SuppressWarnings(PHPMD)
21+
*/
22+
class MySqlPreloadTester extends \Codeception\Actor
23+
{
24+
use _generated\MySqlPreloadTesterActions;
25+
26+
/**
27+
* Define custom actions here
28+
*/
29+
}

Diff for: ‎tests/_support/_generated/IntegrationTesterActions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php //[STAMP] c24edd3767fa499960577b11b53d2923
1+
<?php //[STAMP] 4e578d7ff55748495388fac7d7ae2140
22
// phpcs:ignoreFile
33
namespace Vjik\Codeception\DatabasePopulator\Tests\_generated;
44

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,404 @@
1+
<?php //[STAMP] 31a15213bb4596c070884320dbf4aa16
2+
// phpcs:ignoreFile
3+
namespace Vjik\Codeception\DatabasePopulator\Tests\_generated;
4+
5+
// This class was automatically generated by build task
6+
// You should not change it manually as it will be overwritten on next build
7+
8+
trait MySqlIntegrationTesterActions
9+
{
10+
/**
11+
* @return \Codeception\Scenario
12+
*/
13+
abstract protected function getScenario();
14+
15+
16+
/**
17+
* [!] Method is generated. Documentation taken from corresponding module.
18+
*
19+
* Make sure you are connected to the right database.
20+
*
21+
* ```php
22+
* <?php
23+
* $I->seeNumRecords(2, 'users'); //executed on default database
24+
* $I->amConnectedToDatabase('db_books');
25+
* $I->seeNumRecords(30, 'books'); //executed on db_books database
26+
* //All the next queries will be on db_books
27+
* ```
28+
*
29+
* @throws ModuleConfigException
30+
* @see \Codeception\Module\Db::amConnectedToDatabase()
31+
*/
32+
public function amConnectedToDatabase(string $databaseKey): void {
33+
$this->getScenario()->runStep(new \Codeception\Step\Condition('amConnectedToDatabase', func_get_args()));
34+
}
35+
36+
37+
/**
38+
* [!] Method is generated. Documentation taken from corresponding module.
39+
*
40+
* Can be used with a callback if you don't want to change the current database in your test.
41+
*
42+
* ```php
43+
* <?php
44+
* $I->seeNumRecords(2, 'users'); //executed on default database
45+
* $I->performInDatabase('db_books', function($I) {
46+
* $I->seeNumRecords(30, 'books'); //executed on db_books database
47+
* });
48+
* $I->seeNumRecords(2, 'users'); //executed on default database
49+
* ```
50+
* List of actions can be pragmatically built using `Codeception\Util\ActionSequence`:
51+
*
52+
* ```php
53+
* <?php
54+
* $I->performInDatabase('db_books', ActionSequence::build()
55+
* ->seeNumRecords(30, 'books')
56+
* );
57+
* ```
58+
* Alternatively an array can be used:
59+
*
60+
* ```php
61+
* $I->performInDatabase('db_books', ['seeNumRecords' => [30, 'books']]);
62+
* ```
63+
*
64+
* Choose the syntax you like the most and use it,
65+
*
66+
* Actions executed from array or ActionSequence will print debug output for actions, and adds an action name to
67+
* exception on failure.
68+
*
69+
* @param $databaseKey
70+
* @param ActionSequence|array|callable $actions
71+
* @throws ModuleConfigException
72+
* @see \Codeception\Module\Db::performInDatabase()
73+
*/
74+
public function performInDatabase($databaseKey, $actions): void {
75+
$this->getScenario()->runStep(new \Codeception\Step\Action('performInDatabase', func_get_args()));
76+
}
77+
78+
79+
/**
80+
* [!] Method is generated. Documentation taken from corresponding module.
81+
*
82+
* Inserts an SQL record into a database. This record will be erased after the test,
83+
* unless you've configured "skip_cleanup_if_failed", and the test fails.
84+
*
85+
* ```php
86+
* <?php
87+
* $I->haveInDatabase('users', array('name' => 'miles', 'email' => 'miles@davis.com'));
88+
* ```
89+
* @see \Codeception\Module\Db::haveInDatabase()
90+
*/
91+
public function haveInDatabase(string $table, array $data): int {
92+
return $this->getScenario()->runStep(new \Codeception\Step\Action('haveInDatabase', func_get_args()));
93+
}
94+
95+
96+
/**
97+
* [!] Method is generated. Documentation taken from corresponding module.
98+
*
99+
* Asserts that a row with the given column values exists.
100+
* Provide table name and column values.
101+
*
102+
* ```php
103+
* <?php
104+
* $I->seeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
105+
* ```
106+
* Fails if no such user found.
107+
*
108+
* Comparison expressions can be used as well:
109+
*
110+
* ```php
111+
* <?php
112+
* $I->seeInDatabase('posts', ['num_comments >=' => '0']);
113+
* $I->seeInDatabase('users', ['email like' => 'miles@davis.com']);
114+
* ```
115+
*
116+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
117+
* @see \Codeception\Module\Db::seeInDatabase()
118+
*/
119+
public function seeInDatabase(string $table, array $criteria = []): void {
120+
$this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInDatabase', func_get_args()));
121+
}
122+
/**
123+
* [!] Method is generated. Documentation taken from corresponding module.
124+
*
125+
* [!] Conditional Assertion: Test won't be stopped on fail
126+
* Asserts that a row with the given column values exists.
127+
* Provide table name and column values.
128+
*
129+
* ```php
130+
* <?php
131+
* $I->seeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
132+
* ```
133+
* Fails if no such user found.
134+
*
135+
* Comparison expressions can be used as well:
136+
*
137+
* ```php
138+
* <?php
139+
* $I->seeInDatabase('posts', ['num_comments >=' => '0']);
140+
* $I->seeInDatabase('users', ['email like' => 'miles@davis.com']);
141+
* ```
142+
*
143+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
144+
* @see \Codeception\Module\Db::seeInDatabase()
145+
*/
146+
public function canSeeInDatabase(string $table, array $criteria = []): void {
147+
$this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInDatabase', func_get_args()));
148+
}
149+
150+
151+
/**
152+
* [!] Method is generated. Documentation taken from corresponding module.
153+
*
154+
* Asserts that the given number of records were found in the database.
155+
*
156+
* ```php
157+
* <?php
158+
* $I->seeNumRecords(1, 'users', ['name' => 'davert'])
159+
* ```
160+
*
161+
* @param int $expectedNumber Expected number
162+
* @param string $table Table name
163+
* @param array $criteria Search criteria [Optional]
164+
* @see \Codeception\Module\Db::seeNumRecords()
165+
*/
166+
public function seeNumRecords(int $expectedNumber, string $table, array $criteria = []): void {
167+
$this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumRecords', func_get_args()));
168+
}
169+
/**
170+
* [!] Method is generated. Documentation taken from corresponding module.
171+
*
172+
* [!] Conditional Assertion: Test won't be stopped on fail
173+
* Asserts that the given number of records were found in the database.
174+
*
175+
* ```php
176+
* <?php
177+
* $I->seeNumRecords(1, 'users', ['name' => 'davert'])
178+
* ```
179+
*
180+
* @param int $expectedNumber Expected number
181+
* @param string $table Table name
182+
* @param array $criteria Search criteria [Optional]
183+
* @see \Codeception\Module\Db::seeNumRecords()
184+
*/
185+
public function canSeeNumRecords(int $expectedNumber, string $table, array $criteria = []): void {
186+
$this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumRecords', func_get_args()));
187+
}
188+
189+
190+
/**
191+
* [!] Method is generated. Documentation taken from corresponding module.
192+
*
193+
* Effect is opposite to ->seeInDatabase
194+
*
195+
* Asserts that there is no record with the given column values in a database.
196+
* Provide table name and column values.
197+
*
198+
* ``` php
199+
* <?php
200+
* $I->dontSeeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
201+
* ```
202+
* Fails if such user was found.
203+
*
204+
* Comparison expressions can be used as well:
205+
*
206+
* ```php
207+
* <?php
208+
* $I->dontSeeInDatabase('posts', ['num_comments >=' => '0']);
209+
* $I->dontSeeInDatabase('users', ['email like' => 'miles%']);
210+
* ```
211+
*
212+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
213+
* @see \Codeception\Module\Db::dontSeeInDatabase()
214+
*/
215+
public function dontSeeInDatabase(string $table, array $criteria = []): void {
216+
$this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInDatabase', func_get_args()));
217+
}
218+
/**
219+
* [!] Method is generated. Documentation taken from corresponding module.
220+
*
221+
* [!] Conditional Assertion: Test won't be stopped on fail
222+
* Effect is opposite to ->seeInDatabase
223+
*
224+
* Asserts that there is no record with the given column values in a database.
225+
* Provide table name and column values.
226+
*
227+
* ``` php
228+
* <?php
229+
* $I->dontSeeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
230+
* ```
231+
* Fails if such user was found.
232+
*
233+
* Comparison expressions can be used as well:
234+
*
235+
* ```php
236+
* <?php
237+
* $I->dontSeeInDatabase('posts', ['num_comments >=' => '0']);
238+
* $I->dontSeeInDatabase('users', ['email like' => 'miles%']);
239+
* ```
240+
*
241+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
242+
* @see \Codeception\Module\Db::dontSeeInDatabase()
243+
*/
244+
public function cantSeeInDatabase(string $table, array $criteria = []): void {
245+
$this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInDatabase', func_get_args()));
246+
}
247+
248+
249+
/**
250+
* [!] Method is generated. Documentation taken from corresponding module.
251+
*
252+
* Fetches all values from the column in database.
253+
* Provide table name, desired column and criteria.
254+
*
255+
* ``` php
256+
* <?php
257+
* $mails = $I->grabColumnFromDatabase('users', 'email', array('name' => 'RebOOter'));
258+
* ```
259+
* @see \Codeception\Module\Db::grabColumnFromDatabase()
260+
*/
261+
public function grabColumnFromDatabase(string $table, string $column, array $criteria = []): array {
262+
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabColumnFromDatabase', func_get_args()));
263+
}
264+
265+
266+
/**
267+
* [!] Method is generated. Documentation taken from corresponding module.
268+
*
269+
* Fetches a single column value from a database.
270+
* Provide table name, desired column and criteria.
271+
*
272+
* ``` php
273+
* <?php
274+
* $mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert'));
275+
* ```
276+
* Comparison expressions can be used as well:
277+
*
278+
* ```php
279+
* <?php
280+
* $postNum = $I->grabFromDatabase('posts', 'num_comments', ['num_comments >=' => 100]);
281+
* $mail = $I->grabFromDatabase('users', 'email', ['email like' => 'miles%']);
282+
* ```
283+
*
284+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
285+
*
286+
* @return mixed Returns a single column value or false
287+
* @see \Codeception\Module\Db::grabFromDatabase()
288+
*/
289+
public function grabFromDatabase(string $table, string $column, array $criteria = []) {
290+
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromDatabase', func_get_args()));
291+
}
292+
293+
294+
/**
295+
* [!] Method is generated. Documentation taken from corresponding module.
296+
*
297+
* Fetches a whole entry from a database.
298+
* Make the test fail if the entry is not found.
299+
* Provide table name, desired column and criteria.
300+
*
301+
* ``` php
302+
* <?php
303+
* $mail = $I->grabEntryFromDatabase('users', array('name' => 'Davert'));
304+
* ```
305+
* Comparison expressions can be used as well:
306+
*
307+
* ```php
308+
* <?php
309+
* $post = $I->grabEntryFromDatabase('posts', ['num_comments >=' => 100]);
310+
* $user = $I->grabEntryFromDatabase('users', ['email like' => 'miles%']);
311+
* ```
312+
*
313+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
314+
*
315+
* @return array Returns a single entry value
316+
* @throws PDOException|Exception
317+
* @see \Codeception\Module\Db::grabEntryFromDatabase()
318+
*/
319+
public function grabEntryFromDatabase(string $table, array $criteria = []): array {
320+
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabEntryFromDatabase', func_get_args()));
321+
}
322+
323+
324+
/**
325+
* [!] Method is generated. Documentation taken from corresponding module.
326+
*
327+
* Fetches a set of entries from a database.
328+
* Provide table name and criteria.
329+
*
330+
* ``` php
331+
* <?php
332+
* $mail = $I->grabEntriesFromDatabase('users', array('name' => 'Davert'));
333+
* ```
334+
* Comparison expressions can be used as well:
335+
*
336+
* ```php
337+
* <?php
338+
* $post = $I->grabEntriesFromDatabase('posts', ['num_comments >=' => 100]);
339+
* $user = $I->grabEntriesFromDatabase('users', ['email like' => 'miles%']);
340+
* ```
341+
*
342+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
343+
*
344+
* @return array<array<string, mixed>> Returns an array of all matched rows
345+
* @throws PDOException|Exception
346+
* @see \Codeception\Module\Db::grabEntriesFromDatabase()
347+
*/
348+
public function grabEntriesFromDatabase(string $table, array $criteria = []): array {
349+
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabEntriesFromDatabase', func_get_args()));
350+
}
351+
352+
353+
/**
354+
* [!] Method is generated. Documentation taken from corresponding module.
355+
*
356+
* Returns the number of rows in a database
357+
*
358+
* @param string $table Table name
359+
* @param array $criteria Search criteria [Optional]
360+
* @return int
361+
* @see \Codeception\Module\Db::grabNumRecords()
362+
*/
363+
public function grabNumRecords(string $table, array $criteria = []): int {
364+
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabNumRecords', func_get_args()));
365+
}
366+
367+
368+
/**
369+
* [!] Method is generated. Documentation taken from corresponding module.
370+
*
371+
* Update an SQL record into a database.
372+
*
373+
* ```php
374+
* <?php
375+
* $I->updateInDatabase('users', array('isAdmin' => true), array('email' => 'miles@davis.com'));
376+
* ```
377+
* @see \Codeception\Module\Db::updateInDatabase()
378+
*/
379+
public function updateInDatabase(string $table, array $data, array $criteria = []): void {
380+
$this->getScenario()->runStep(new \Codeception\Step\Action('updateInDatabase', func_get_args()));
381+
}
382+
383+
384+
/**
385+
* [!] Method is generated. Documentation taken from corresponding module.
386+
*
387+
*
388+
* @see \Vjik\Codeception\DatabasePopulator\Module::loadDump()
389+
*/
390+
public function loadDump(string $dumps = ''): void {
391+
$this->getScenario()->runStep(new \Codeception\Step\Action('loadDump', func_get_args()));
392+
}
393+
394+
395+
/**
396+
* [!] Method is generated. Documentation taken from corresponding module.
397+
*
398+
*
399+
* @see \Vjik\Codeception\DatabasePopulator\Module::loadRows()
400+
*/
401+
public function loadRows(string $sets = ''): void {
402+
$this->getScenario()->runStep(new \Codeception\Step\Action('loadRows', func_get_args()));
403+
}
404+
}
+404
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,404 @@
1+
<?php //[STAMP] 35696bfcd3d6b1e0b43b3eb10fddb837
2+
// phpcs:ignoreFile
3+
namespace Vjik\Codeception\DatabasePopulator\Tests\_generated;
4+
5+
// This class was automatically generated by build task
6+
// You should not change it manually as it will be overwritten on next build
7+
8+
trait MySqlPreloadTesterActions
9+
{
10+
/**
11+
* @return \Codeception\Scenario
12+
*/
13+
abstract protected function getScenario();
14+
15+
16+
/**
17+
* [!] Method is generated. Documentation taken from corresponding module.
18+
*
19+
* Make sure you are connected to the right database.
20+
*
21+
* ```php
22+
* <?php
23+
* $I->seeNumRecords(2, 'users'); //executed on default database
24+
* $I->amConnectedToDatabase('db_books');
25+
* $I->seeNumRecords(30, 'books'); //executed on db_books database
26+
* //All the next queries will be on db_books
27+
* ```
28+
*
29+
* @throws ModuleConfigException
30+
* @see \Codeception\Module\Db::amConnectedToDatabase()
31+
*/
32+
public function amConnectedToDatabase(string $databaseKey): void {
33+
$this->getScenario()->runStep(new \Codeception\Step\Condition('amConnectedToDatabase', func_get_args()));
34+
}
35+
36+
37+
/**
38+
* [!] Method is generated. Documentation taken from corresponding module.
39+
*
40+
* Can be used with a callback if you don't want to change the current database in your test.
41+
*
42+
* ```php
43+
* <?php
44+
* $I->seeNumRecords(2, 'users'); //executed on default database
45+
* $I->performInDatabase('db_books', function($I) {
46+
* $I->seeNumRecords(30, 'books'); //executed on db_books database
47+
* });
48+
* $I->seeNumRecords(2, 'users'); //executed on default database
49+
* ```
50+
* List of actions can be pragmatically built using `Codeception\Util\ActionSequence`:
51+
*
52+
* ```php
53+
* <?php
54+
* $I->performInDatabase('db_books', ActionSequence::build()
55+
* ->seeNumRecords(30, 'books')
56+
* );
57+
* ```
58+
* Alternatively an array can be used:
59+
*
60+
* ```php
61+
* $I->performInDatabase('db_books', ['seeNumRecords' => [30, 'books']]);
62+
* ```
63+
*
64+
* Choose the syntax you like the most and use it,
65+
*
66+
* Actions executed from array or ActionSequence will print debug output for actions, and adds an action name to
67+
* exception on failure.
68+
*
69+
* @param $databaseKey
70+
* @param ActionSequence|array|callable $actions
71+
* @throws ModuleConfigException
72+
* @see \Codeception\Module\Db::performInDatabase()
73+
*/
74+
public function performInDatabase($databaseKey, $actions): void {
75+
$this->getScenario()->runStep(new \Codeception\Step\Action('performInDatabase', func_get_args()));
76+
}
77+
78+
79+
/**
80+
* [!] Method is generated. Documentation taken from corresponding module.
81+
*
82+
* Inserts an SQL record into a database. This record will be erased after the test,
83+
* unless you've configured "skip_cleanup_if_failed", and the test fails.
84+
*
85+
* ```php
86+
* <?php
87+
* $I->haveInDatabase('users', array('name' => 'miles', 'email' => 'miles@davis.com'));
88+
* ```
89+
* @see \Codeception\Module\Db::haveInDatabase()
90+
*/
91+
public function haveInDatabase(string $table, array $data): int {
92+
return $this->getScenario()->runStep(new \Codeception\Step\Action('haveInDatabase', func_get_args()));
93+
}
94+
95+
96+
/**
97+
* [!] Method is generated. Documentation taken from corresponding module.
98+
*
99+
* Asserts that a row with the given column values exists.
100+
* Provide table name and column values.
101+
*
102+
* ```php
103+
* <?php
104+
* $I->seeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
105+
* ```
106+
* Fails if no such user found.
107+
*
108+
* Comparison expressions can be used as well:
109+
*
110+
* ```php
111+
* <?php
112+
* $I->seeInDatabase('posts', ['num_comments >=' => '0']);
113+
* $I->seeInDatabase('users', ['email like' => 'miles@davis.com']);
114+
* ```
115+
*
116+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
117+
* @see \Codeception\Module\Db::seeInDatabase()
118+
*/
119+
public function seeInDatabase(string $table, array $criteria = []): void {
120+
$this->getScenario()->runStep(new \Codeception\Step\Assertion('seeInDatabase', func_get_args()));
121+
}
122+
/**
123+
* [!] Method is generated. Documentation taken from corresponding module.
124+
*
125+
* [!] Conditional Assertion: Test won't be stopped on fail
126+
* Asserts that a row with the given column values exists.
127+
* Provide table name and column values.
128+
*
129+
* ```php
130+
* <?php
131+
* $I->seeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
132+
* ```
133+
* Fails if no such user found.
134+
*
135+
* Comparison expressions can be used as well:
136+
*
137+
* ```php
138+
* <?php
139+
* $I->seeInDatabase('posts', ['num_comments >=' => '0']);
140+
* $I->seeInDatabase('users', ['email like' => 'miles@davis.com']);
141+
* ```
142+
*
143+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
144+
* @see \Codeception\Module\Db::seeInDatabase()
145+
*/
146+
public function canSeeInDatabase(string $table, array $criteria = []): void {
147+
$this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeInDatabase', func_get_args()));
148+
}
149+
150+
151+
/**
152+
* [!] Method is generated. Documentation taken from corresponding module.
153+
*
154+
* Asserts that the given number of records were found in the database.
155+
*
156+
* ```php
157+
* <?php
158+
* $I->seeNumRecords(1, 'users', ['name' => 'davert'])
159+
* ```
160+
*
161+
* @param int $expectedNumber Expected number
162+
* @param string $table Table name
163+
* @param array $criteria Search criteria [Optional]
164+
* @see \Codeception\Module\Db::seeNumRecords()
165+
*/
166+
public function seeNumRecords(int $expectedNumber, string $table, array $criteria = []): void {
167+
$this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumRecords', func_get_args()));
168+
}
169+
/**
170+
* [!] Method is generated. Documentation taken from corresponding module.
171+
*
172+
* [!] Conditional Assertion: Test won't be stopped on fail
173+
* Asserts that the given number of records were found in the database.
174+
*
175+
* ```php
176+
* <?php
177+
* $I->seeNumRecords(1, 'users', ['name' => 'davert'])
178+
* ```
179+
*
180+
* @param int $expectedNumber Expected number
181+
* @param string $table Table name
182+
* @param array $criteria Search criteria [Optional]
183+
* @see \Codeception\Module\Db::seeNumRecords()
184+
*/
185+
public function canSeeNumRecords(int $expectedNumber, string $table, array $criteria = []): void {
186+
$this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumRecords', func_get_args()));
187+
}
188+
189+
190+
/**
191+
* [!] Method is generated. Documentation taken from corresponding module.
192+
*
193+
* Effect is opposite to ->seeInDatabase
194+
*
195+
* Asserts that there is no record with the given column values in a database.
196+
* Provide table name and column values.
197+
*
198+
* ``` php
199+
* <?php
200+
* $I->dontSeeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
201+
* ```
202+
* Fails if such user was found.
203+
*
204+
* Comparison expressions can be used as well:
205+
*
206+
* ```php
207+
* <?php
208+
* $I->dontSeeInDatabase('posts', ['num_comments >=' => '0']);
209+
* $I->dontSeeInDatabase('users', ['email like' => 'miles%']);
210+
* ```
211+
*
212+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
213+
* @see \Codeception\Module\Db::dontSeeInDatabase()
214+
*/
215+
public function dontSeeInDatabase(string $table, array $criteria = []): void {
216+
$this->getScenario()->runStep(new \Codeception\Step\Action('dontSeeInDatabase', func_get_args()));
217+
}
218+
/**
219+
* [!] Method is generated. Documentation taken from corresponding module.
220+
*
221+
* [!] Conditional Assertion: Test won't be stopped on fail
222+
* Effect is opposite to ->seeInDatabase
223+
*
224+
* Asserts that there is no record with the given column values in a database.
225+
* Provide table name and column values.
226+
*
227+
* ``` php
228+
* <?php
229+
* $I->dontSeeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
230+
* ```
231+
* Fails if such user was found.
232+
*
233+
* Comparison expressions can be used as well:
234+
*
235+
* ```php
236+
* <?php
237+
* $I->dontSeeInDatabase('posts', ['num_comments >=' => '0']);
238+
* $I->dontSeeInDatabase('users', ['email like' => 'miles%']);
239+
* ```
240+
*
241+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
242+
* @see \Codeception\Module\Db::dontSeeInDatabase()
243+
*/
244+
public function cantSeeInDatabase(string $table, array $criteria = []): void {
245+
$this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('dontSeeInDatabase', func_get_args()));
246+
}
247+
248+
249+
/**
250+
* [!] Method is generated. Documentation taken from corresponding module.
251+
*
252+
* Fetches all values from the column in database.
253+
* Provide table name, desired column and criteria.
254+
*
255+
* ``` php
256+
* <?php
257+
* $mails = $I->grabColumnFromDatabase('users', 'email', array('name' => 'RebOOter'));
258+
* ```
259+
* @see \Codeception\Module\Db::grabColumnFromDatabase()
260+
*/
261+
public function grabColumnFromDatabase(string $table, string $column, array $criteria = []): array {
262+
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabColumnFromDatabase', func_get_args()));
263+
}
264+
265+
266+
/**
267+
* [!] Method is generated. Documentation taken from corresponding module.
268+
*
269+
* Fetches a single column value from a database.
270+
* Provide table name, desired column and criteria.
271+
*
272+
* ``` php
273+
* <?php
274+
* $mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert'));
275+
* ```
276+
* Comparison expressions can be used as well:
277+
*
278+
* ```php
279+
* <?php
280+
* $postNum = $I->grabFromDatabase('posts', 'num_comments', ['num_comments >=' => 100]);
281+
* $mail = $I->grabFromDatabase('users', 'email', ['email like' => 'miles%']);
282+
* ```
283+
*
284+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
285+
*
286+
* @return mixed Returns a single column value or false
287+
* @see \Codeception\Module\Db::grabFromDatabase()
288+
*/
289+
public function grabFromDatabase(string $table, string $column, array $criteria = []) {
290+
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabFromDatabase', func_get_args()));
291+
}
292+
293+
294+
/**
295+
* [!] Method is generated. Documentation taken from corresponding module.
296+
*
297+
* Fetches a whole entry from a database.
298+
* Make the test fail if the entry is not found.
299+
* Provide table name, desired column and criteria.
300+
*
301+
* ``` php
302+
* <?php
303+
* $mail = $I->grabEntryFromDatabase('users', array('name' => 'Davert'));
304+
* ```
305+
* Comparison expressions can be used as well:
306+
*
307+
* ```php
308+
* <?php
309+
* $post = $I->grabEntryFromDatabase('posts', ['num_comments >=' => 100]);
310+
* $user = $I->grabEntryFromDatabase('users', ['email like' => 'miles%']);
311+
* ```
312+
*
313+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
314+
*
315+
* @return array Returns a single entry value
316+
* @throws PDOException|Exception
317+
* @see \Codeception\Module\Db::grabEntryFromDatabase()
318+
*/
319+
public function grabEntryFromDatabase(string $table, array $criteria = []): array {
320+
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabEntryFromDatabase', func_get_args()));
321+
}
322+
323+
324+
/**
325+
* [!] Method is generated. Documentation taken from corresponding module.
326+
*
327+
* Fetches a set of entries from a database.
328+
* Provide table name and criteria.
329+
*
330+
* ``` php
331+
* <?php
332+
* $mail = $I->grabEntriesFromDatabase('users', array('name' => 'Davert'));
333+
* ```
334+
* Comparison expressions can be used as well:
335+
*
336+
* ```php
337+
* <?php
338+
* $post = $I->grabEntriesFromDatabase('posts', ['num_comments >=' => 100]);
339+
* $user = $I->grabEntriesFromDatabase('users', ['email like' => 'miles%']);
340+
* ```
341+
*
342+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
343+
*
344+
* @return array<array<string, mixed>> Returns an array of all matched rows
345+
* @throws PDOException|Exception
346+
* @see \Codeception\Module\Db::grabEntriesFromDatabase()
347+
*/
348+
public function grabEntriesFromDatabase(string $table, array $criteria = []): array {
349+
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabEntriesFromDatabase', func_get_args()));
350+
}
351+
352+
353+
/**
354+
* [!] Method is generated. Documentation taken from corresponding module.
355+
*
356+
* Returns the number of rows in a database
357+
*
358+
* @param string $table Table name
359+
* @param array $criteria Search criteria [Optional]
360+
* @return int
361+
* @see \Codeception\Module\Db::grabNumRecords()
362+
*/
363+
public function grabNumRecords(string $table, array $criteria = []): int {
364+
return $this->getScenario()->runStep(new \Codeception\Step\Action('grabNumRecords', func_get_args()));
365+
}
366+
367+
368+
/**
369+
* [!] Method is generated. Documentation taken from corresponding module.
370+
*
371+
* Update an SQL record into a database.
372+
*
373+
* ```php
374+
* <?php
375+
* $I->updateInDatabase('users', array('isAdmin' => true), array('email' => 'miles@davis.com'));
376+
* ```
377+
* @see \Codeception\Module\Db::updateInDatabase()
378+
*/
379+
public function updateInDatabase(string $table, array $data, array $criteria = []): void {
380+
$this->getScenario()->runStep(new \Codeception\Step\Action('updateInDatabase', func_get_args()));
381+
}
382+
383+
384+
/**
385+
* [!] Method is generated. Documentation taken from corresponding module.
386+
*
387+
*
388+
* @see \Vjik\Codeception\DatabasePopulator\Module::loadDump()
389+
*/
390+
public function loadDump(string $dumps = ''): void {
391+
$this->getScenario()->runStep(new \Codeception\Step\Action('loadDump', func_get_args()));
392+
}
393+
394+
395+
/**
396+
* [!] Method is generated. Documentation taken from corresponding module.
397+
*
398+
*
399+
* @see \Vjik\Codeception\DatabasePopulator\Module::loadRows()
400+
*/
401+
public function loadRows(string $sets = ''): void {
402+
$this->getScenario()->runStep(new \Codeception\Step\Action('loadRows', func_get_args()));
403+
}
404+
}

Diff for: ‎tests/_support/_generated/PreloadTesterActions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php //[STAMP] 35696bfcd3d6b1e0b43b3eb10fddb837
1+
<?php //[STAMP] e0837f576ca1ee13afb3d20126f35a2a
22
// phpcs:ignoreFile
33
namespace Vjik\Codeception\DatabasePopulator\Tests\_generated;
44

0 commit comments

Comments
 (0)
Please sign in to comment.