forked from Codeception/module-db
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDb.php
More file actions
74 lines (70 loc) · 2.14 KB
/
Copy pathDb.php
File metadata and controls
74 lines (70 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
namespace Codeception\Lib\Interfaces;
interface Db
{
/**
* Asserts that a row with the given column values exists.
* Provide table name and column values.
*
* ```php
* <?php
* $I->seeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
* ```
* Fails if no such user found.
*
* Comparison expressions can be used as well:
*
* ```php
* <?php
* $I->seeInDatabase('posts', ['num_comments >=' => '0']);
* $I->seeInDatabase('users', ['email like' => 'miles@davis.com']);
* ```
*
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
*/
public function seeInDatabase(string $table, array $criteria = []): void;
/**
* Effect is opposite to ->seeInDatabase
*
* Asserts that there is no record with the given column values in a database.
* Provide table name and column values.
*
* ``` php
* <?php
* $I->dontSeeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
* ```
* Fails if such user was found.
*
* Comparison expressions can be used as well:
*
* ```php
* <?php
* $I->dontSeeInDatabase('posts', ['num_comments >=' => '0']);
* $I->dontSeeInDatabase('users', ['email like' => 'miles%']);
* ```
*
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
*/
public function dontSeeInDatabase(string $table, array $criteria = []): void;
/**
* Fetches a single column value from a database.
* Provide table name, desired column and criteria.
*
* ``` php
* <?php
* $mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert'));
* ```
* Comparison expressions can be used as well:
*
* ```php
* <?php
* $post = $I->grabFromDatabase('posts', ['num_comments >=' => 100]);
* $user = $I->grabFromDatabase('users', ['email like' => 'miles%']);
* ```
*
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
*
* @return mixed
*/
public function grabFromDatabase(string $table, string $column, array $criteria = []);
}