예제 #1
0
 /**
  * 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);
 }
예제 #2
0
 public function testGetSpec()
 {
     $spec = $this->makeTaskSafely()->getSpec();
     $this->assertTrue(Std::truthy($spec === null, $spec instanceof Spec));
 }
예제 #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)]]);
 }