| @@ 135-167 (lines=33) @@ | ||
| 132 | $this->assertInternalType('array', $data); |
|
| 133 | } |
|
| 134 | ||
| 135 | public function testGetActivitiesRange() |
|
| 136 | { |
|
| 137 | $testData = [ |
|
| 138 | [ |
|
| 139 | 'id' => rand(1, 100), |
|
| 140 | 'message' => 'test one', |
|
| 141 | ], |
|
| 142 | [ |
|
| 143 | 'id' => rand(101, 200), |
|
| 144 | 'message' => 'test two', |
|
| 145 | ], |
|
| 146 | [ |
|
| 147 | 'id' => rand(201, 300), |
|
| 148 | 'message' => 'test three', |
|
| 149 | ], |
|
| 150 | ]; |
|
| 151 | ||
| 152 | array_walk($testData, [$this, 'insertData']); |
|
| 153 | ||
| 154 | $repository = new MysqlActivityRepository(self::$connection); |
|
| 155 | $data = $repository->getActivities(2, 1); |
|
| 156 | ||
| 157 | $this->assertNotFalse($data); |
|
| 158 | $this->assertInternalType('array', $data); |
|
| 159 | $this->assertCount(2, $data); |
|
| 160 | ||
| 161 | $testData = array_slice($testData, 1, 2); |
|
| 162 | ||
| 163 | foreach ($testData as $key => $testRow) { |
|
| 164 | $this->assertInternalType('array', $testRow); |
|
| 165 | $this->assertArraySubset($testRow, $data[$key]); |
|
| 166 | } |
|
| 167 | } |
|
| 168 | ||
| 169 | public function testGetActivitiesRangeFailure() |
|
| 170 | { |
|
| @@ 108-140 (lines=33) @@ | ||
| 105 | $this->assertInternalType('array', $data); |
|
| 106 | } |
|
| 107 | ||
| 108 | public function testGetChangesRange() |
|
| 109 | { |
|
| 110 | $testData = [ |
|
| 111 | [ |
|
| 112 | 'id' => rand(1, 100), |
|
| 113 | 'message' => 'test one', |
|
| 114 | ], |
|
| 115 | [ |
|
| 116 | 'id' => rand(101, 200), |
|
| 117 | 'message' => 'test two', |
|
| 118 | ], |
|
| 119 | [ |
|
| 120 | 'id' => rand(201, 300), |
|
| 121 | 'message' => 'test three', |
|
| 122 | ], |
|
| 123 | ]; |
|
| 124 | ||
| 125 | array_walk($testData, [$this, 'insertData']); |
|
| 126 | ||
| 127 | $repository = new MysqlChangelogRepository(self::$connection); |
|
| 128 | $data = $repository->getChanges(2, 1); |
|
| 129 | ||
| 130 | $this->assertNotFalse($data); |
|
| 131 | $this->assertInternalType('array', $data); |
|
| 132 | $this->assertCount(2, $data); |
|
| 133 | ||
| 134 | $testData = array_slice($testData, 1, 2); |
|
| 135 | ||
| 136 | foreach ($testData as $key => $testRow) { |
|
| 137 | $this->assertInternalType('array', $testRow); |
|
| 138 | $this->assertArraySubset($testRow, $data[$key]); |
|
| 139 | } |
|
| 140 | } |
|
| 141 | ||
| 142 | public function testGetChangesRangeFailure() |
|
| 143 | { |
|