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