Skip to content

Commit

Permalink
phalcon#14203 - Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aziz Muzafarov committed Nov 7, 2021
1 parent 1f121d4 commit 1412626
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions tests/integration/Validation/AllowEmptyCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ public function validationAllowEmptyFalse(IntegrationTester $I)
$validation = new Validation();
$validator = new Alpha(['allowEmpty' => false]);
$validation->add('name', $validator);
$messages = $validation->validate($data);

$I->assertInstanceOf(Messages::class, $validation->validate($data));
$I->assertInstanceOf(0, $messages->count());
}

public function validationAllowEmptyTrue(IntegrationTester $I)
Expand All @@ -46,7 +47,8 @@ public function validationAllowEmptyTrue(IntegrationTester $I)
$validation = new Validation();
$validator = new Alpha(['allowEmpty' => true]);
$validation->add('name', $validator);
$messages = $validation->validate($data);

$I->assertTrue($validation->validate($data));
$I->assertTrue(0, $messages->count());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function validationValidatorCallbackValidateSingleFieldBoolean(Integratio
return empty($data['admin']);
},
'message' => 'You cant provide both admin and user.',
'allowEmpty' => true,
]
)
);
Expand All @@ -60,7 +61,7 @@ public function validationValidatorCallbackValidateSingleFieldBoolean(Integratio
]
);

$I->assertCount(0, $messages);
$I->assertCount(0, $messages->count());


$messages = $validation->validate(
Expand All @@ -70,7 +71,7 @@ public function validationValidatorCallbackValidateSingleFieldBoolean(Integratio
]
);

$I->assertCount(0, $messages);
$I->assertCount(0, $messages->count());


$messages = $validation->validate(
Expand All @@ -80,7 +81,7 @@ public function validationValidatorCallbackValidateSingleFieldBoolean(Integratio
]
);

$I->assertCount(1, $messages);
$I->assertCount(1, $messages->count());


$expected = new Messages(
Expand Down

0 comments on commit 1412626

Please sign in to comment.