notEmpty() public static method

public static notEmpty ( mixed $value, string | null $customMessage = null ) : void
$value mixed
$customMessage string | null
return void
Beispiel #1
0
 /**
  * @param string $location
  * @return $this
  * @throws InvalidArgumentException
  */
 public function setLocation($location)
 {
     IsValid::notEmpty($location, 'Location cannot be empty');
     $this->location = $location;
     return $this;
 }
Beispiel #2
0
 /**
  * @test
  * @dataProvider emptyValues
  * @param mixed $value
  * @param string $customMessage
  */
 public function shouldThrowExceptionWithCustomMessageWhenValueIsEmpty($value, $customMessage)
 {
     //when
     try {
         IsValid::notEmpty($value, $customMessage);
         $this->assertFalse(true, 'Triggered when exception is not throw');
     } catch (InvalidArgumentException $e) {
         //then
         $this->assertEquals($customMessage, $e->getMessage());
         $this->assertInstanceOf('\\InvalidArgumentException', $e);
     }
 }