Пример #1
0
 /**
  * Tests the hasAtLeast method
  *
  * @return void
  */
 public function testHasAtLeast()
 {
     $validator = new Validator();
     $validator->hasAtLeast('things', 3);
     $this->assertEmpty($validator->errors(['things' => [1, 2, 3]]));
     $this->assertEmpty($validator->errors(['things' => [1, 2, 3, 4]]));
     $this->assertNotEmpty($validator->errors(['things' => [1, 2]]));
     $this->assertNotEmpty($validator->errors(['things' => []]));
     $this->assertNotEmpty($validator->errors(['things' => 'string']));
     $this->assertEmpty($validator->errors(['things' => ['_ids' => [1, 2, 3]]]));
     $this->assertEmpty($validator->errors(['things' => ['_ids' => [1, 2, 3, 4]]]));
     $this->assertNotEmpty($validator->errors(['things' => ['_ids' => [1, 2]]]));
     $this->assertNotEmpty($validator->errors(['things' => ['_ids' => []]]));
     $this->assertNotEmpty($validator->errors(['things' => ['_ids' => 'string']]));
 }