Completed
Push — master ( c19566...1cee1d )
by Alex
02:03
created

PdoCrudMock::rollback()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 0
dl 0
loc 2
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
namespace Mezon\PdoCrud\Tests;
3
4
class PdoCrudMock extends \Mezon\PdoCrud\PdoCrud
5
{
6
7
    /**
8
     * Selected result
9
     *
10
     * @var array
11
     */
12
    public $selectResult = [];
13
14
    /**
15
     *
16
     * {@inheritdoc}
17
     * @see \Mezon\PdoCrud\PdoCrud::select()
18
     */
19
    public function select(
20
        string $fields,
21
        string $tableNames,
22
        string $where = '1 = 1',
23
        int $from = 0,
24
        int $limit = 1000000): array
25
    {
26
        return $this->selectResult;
27
    }
28
29
    /**
30
     * Counter for update method calls
31
     *
32
     * @var integer
33
     */
34
    public $updateWasCalledCounter = 0;
35
36
    /**
37
     *
38
     * {@inheritdoc}
39
     * @see \Mezon\PdoCrud\PdoCrud::update()
40
     */
41
    public function update(string $tableName, array $record, string $where, int $limit = 10000000): int
42
    {
43
        $this->updateWasCalledCounter ++;
44
45
        return 1;
46
    }
47
48
    /**
49
     * Counter for delete method calls
50
     *
51
     * @var integer
52
     */
53
    public $deleteWasCalledCounter = 0;
54
55
    /**
56
     *
57
     * {@inheritdoc}
58
     * @see \Mezon\PdoCrud\PdoCrud::delete()
59
     */
60
    public function delete($tableName, $where, $limit = 10000000): int
61
    {
62
        $this->deleteWasCalledCounter ++;
63
64
        return 1;
65
    }
66
67
    /**
68
     * Locked tables
69
     *
70
     * @var array
71
     */
72
    public $lockedTables = [];
73
74
    /**
75
     * Locked tables modes
76
     *
77
     * @var array
78
     */
79
    public $lockedTablesModes = [];
80
81
    /**
82
     *
83
     * {@inheritdoc}
84
     * @see \Mezon\PdoCrud\PdoCrud::lock()
85
     */
86
    public function lock(array $tables, array $modes): void
87
    {
88
        $this->lockedTables = $tables;
89
        $this->lockedTablesModes = $modes;
90
    }
91
92
    /**
93
     *
94
     * {@inheritdoc}
95
     * @see \Mezon\PdoCrud\PdoCrud::unlock()
96
     */
97
    public function unlock(): void
98
    {
99
        // nop
100
    }
101
102
    public $transactionWasStarted = true;
103
104
    /**
105
     *
106
     * {@inheritdoc}
107
     * @see \Mezon\PdoCrud\PdoCrud::startTransaction()
108
     */
109
    public function startTransaction(): void
110
    {
111
        $this->transactionWasStarted = true;
112
    }
113
114
    /**
115
     *
116
     * {@inheritdoc}
117
     * @see \Mezon\PdoCrud\PdoCrud::rollback()
118
     */
119
    public function rollback(): void
120
    {
121
        // nop
122
    }
123
}
124