| @@ 166-176 (lines=11) @@ | ||
| 163 | * @dataProvider emptyValues |
|
| 164 | * @param mixed $value |
|
| 165 | */ |
|
| 166 | public function shouldThrowExceptionWhenValueIsEmpty($value) |
|
| 167 | { |
|
| 168 | //when |
|
| 169 | try { |
|
| 170 | IsValid::notEmpty($value); |
|
| 171 | $this->assertFalse(true, 'Triggered when exception is not throw'); |
|
| 172 | } catch (InvalidArgumentException $e) { |
|
| 173 | //then |
|
| 174 | $this->assertEquals('Value cannot be empty', $e->getMessage()); |
|
| 175 | $this->assertInstanceOf('\InvalidArgumentException', $e); |
|
| 176 | } |
|
| 177 | } |
|
| 178 | ||
| 179 | /** |
|
| @@ 185-195 (lines=11) @@ | ||
| 182 | * @param mixed $value |
|
| 183 | * @param string $customMessage |
|
| 184 | */ |
|
| 185 | public function shouldThrowExceptionWithCustomMessageWhenValueIsEmpty($value, $customMessage) |
|
| 186 | { |
|
| 187 | //when |
|
| 188 | try { |
|
| 189 | IsValid::notEmpty($value, $customMessage); |
|
| 190 | $this->assertFalse(true, 'Triggered when exception is not throw'); |
|
| 191 | } catch (InvalidArgumentException $e) { |
|
| 192 | //then |
|
| 193 | $this->assertEquals($customMessage, $e->getMessage()); |
|
| 194 | $this->assertInstanceOf('\InvalidArgumentException', $e); |
|
| 195 | } |
|
| 196 | } |
|
| 197 | ||
| 198 | public function emptyValues() |
|