|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
namespace SetBased\Stratum\MySql\Test; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* Test cases for stored routines with designation type none. |
|
8
|
|
|
*/ |
|
9
|
|
|
class NoneTest extends DataLayerTestCase |
|
10
|
|
|
{ |
|
11
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
12
|
|
|
/** |
|
13
|
|
|
* Stored routine with designation type none must return the number of rows affected. |
|
14
|
|
|
*/ |
|
15
|
|
|
public function test1() |
|
16
|
|
|
{ |
|
17
|
|
|
$ret = $this->dataLayer->tstTestNone(0); |
|
18
|
|
|
self::assertEquals(0, $ret); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
22
|
|
|
/** |
|
23
|
|
|
* Stored routine with designation type none must return the number of rows affected. |
|
24
|
|
|
*/ |
|
25
|
|
|
public function test2() |
|
26
|
|
|
{ |
|
27
|
|
|
// MariaDB 10.3 and above returns the total number of rows affected in the stored routine (not the affected rows |
|
28
|
|
|
// of the last statement). |
|
29
|
|
|
$expected = ($this->isMariaDB103plus()) ? 2 : 1; |
|
30
|
|
|
|
|
31
|
|
|
$ret = $this->dataLayer->tstTestNone(1); |
|
32
|
|
|
self::assertEquals($expected, $ret); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
36
|
|
|
/** |
|
37
|
|
|
* Stored routine with designation type none must return the number of rows affected. |
|
38
|
|
|
*/ |
|
39
|
|
|
public function test3() |
|
40
|
|
|
{ |
|
41
|
|
|
// MariaDB 10.3 and above returns the total number of rows affected in the stored routine (not the affected rows |
|
42
|
|
|
// of the last statement). |
|
43
|
|
|
$expected = ($this->isMariaDB103plus()) ? 40 : 20; |
|
44
|
|
|
|
|
45
|
|
|
$ret = $this->dataLayer->tstTestNone(20); |
|
46
|
|
|
self::assertEquals($expected, $ret); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
//---------------------------------------------------------------------------------------------------------------------- |
|
53
|
|
|
|