1 | <?php |
||
2 | namespace Mezon\PdoCrud\Tests; |
||
3 | |||
4 | use PHPUnit\Framework\TestCase; |
||
5 | use Mezon\PdoCrud\PdoCrud; |
||
6 | |||
7 | /** |
||
8 | * Utilities for unit-tests |
||
9 | */ |
||
10 | class Utils |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * List of methods to be mocked |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | public static $mockingMethods = [ |
||
19 | 'query', |
||
20 | 'processQueryError', |
||
21 | 'lastInsertId' |
||
22 | ]; |
||
23 | |||
24 | /** |
||
25 | * Method returns mock of the PdoCrud object |
||
26 | * Mocked methods: query, processQueryError, lastInsertId |
||
27 | * |
||
28 | * @param \PHPUnit\Framework\TestCase $test |
||
29 | * @return object |
||
30 | */ |
||
31 | public static function getMock(TestCase $test): object |
||
32 | { |
||
33 | return $test->getMockBuilder(PdoCrud::class) |
||
0 ignored issues
–
show
|
|||
34 | ->setMethods(self::$mockingMethods) |
||
35 | ->disableOriginalConstructor() |
||
36 | ->getMock(); |
||
37 | } |
||
38 | } |
||
39 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.