/**
  * Check if the constraint is met.
  *
  * @param mixed $value
  * @param array $context
  *
  * @return mixed
  */
 public function check($value, array $context = [])
 {
     $length = mb_strlen($value);
     return !Std::truthy($this->min > $length, $this->max !== -1 && $this->max < $length);
 }
 public function testGetSpec()
 {
     $spec = $this->makeTaskSafely()->getSpec();
     $this->assertTrue(Std::truthy($spec === null, $spec instanceof Spec));
 }
Beispiel #3
0
 public function testTruthy()
 {
     $this->assertEqualsMatrix([[true, Std::truthy(true)], [false, Std::truthy()], [false, Std::truthy(false)], [false, Std::truthy(false, false)], [true, Std::truthy(false, true)], [true, Std::truthy(false, false, true)], [true, Std::truthy(false, false, true, false)]]);
 }