Пример #1
0
 /**
  * @depends testNotBlank
  * @test method with "nullOr" prefix
  */
 public function testMethodsWithNullOrPrefix()
 {
     Assert::nullOrNotBlank(null);
     Assert::nullOrNotBlank('a');
     $this->setExpectedException('Wookieb\\Assert\\AssertException', 'Name cannot be blank');
     Assert::nullOrNotBlank('', 'Name cannot be blank');
 }
 /**
  * Sets name of method that should be called to retrieve value of property
  *
  * @param string $getterName
  * @return self
  * @throws \InvalidArgumentException when name is empty
  */
 public function setGetterName($getterName)
 {
     Assert::nullOrNotBlank($getterName, 'Getter name cannot be empty');
     $this->getterName = $getterName;
     return $this;
 }
 /**
  * Set current name as provided in argument
  * If name is null then default name (from defaultName property) will be set
  *
  * @param null|string $name
  *
  * @throws \InvalidArgumentException when name is invalid
  */
 public function __construct($name = null)
 {
     Assert::nullOrNotBlank($name, 'Name of type outline cannot be empty');
     $this->name = $name ?: $this->defaultName;
 }
 /**
  * Sets name of getter method
  *
  * @param string $getter
  * @return self
  *
  * @throws \InvalidArgumentException when name is empty
  * @throws \BadMethodCallException when accessors are disabled
  */
 public function setGetter($getter = null)
 {
     Assert::nullOrNotBlank($getter, 'Getter name cannot be empty');
     $this->getter = $getter;
     return $this;
 }