Skip to content
Permalink
Browse files

Added parentheses to the class calls

  • Loading branch information...
davidyell committed May 5, 2017
1 parent bb9e73e commit 8e9cf162373ea2ecaa21e1f936363dfa9715ebe7
Showing with 40 additions and 40 deletions.
  1. +40 −40 tests/TestCase/Validation/ValidatorTest.php
@@ -31,7 +31,7 @@ class ValidatorTest extends TestCase
*/
public function testAddingRulesToField()
{
$validator = new Validator;
$validator = new Validator();
$validator->add('title', 'not-blank', ['rule' => 'notBlank']);
$set = $validator->field('title');
$this->assertInstanceOf('Cake\Validation\ValidationSet', $set);
@@ -126,7 +126,7 @@ public function testAddNestedManyProviders()
*/
public function testFieldDefault()
{
$validator = new Validator;
$validator = new Validator();
$this->assertFalse($validator->hasField('foo'));
$field = $validator->field('foo');
@@ -142,7 +142,7 @@ public function testFieldDefault()
*/
public function testFieldSetter()
{
$validator = new Validator;
$validator = new Validator();
$validationSet = new ValidationSet;
$validator->field('thing', $validationSet);
$this->assertSame($validationSet, $validator->field('thing'));
@@ -155,7 +155,7 @@ public function testFieldSetter()
*/
public function testRemove()
{
$validator = new Validator;
$validator = new Validator();
$validator->add('title', 'not-blank', ['rule' => 'notBlank']);
$validator->add('title', 'foo', ['rule' => 'bar']);
$this->assertCount(2, $validator->field('title'));
@@ -178,7 +178,7 @@ public function testRemove()
*/
public function testRequirePresence()
{
$validator = new Validator;
$validator = new Validator();
$this->assertSame($validator, $validator->requirePresence('title'));
$this->assertTrue($validator->field('title')->isPresenceRequired());
@@ -199,7 +199,7 @@ public function testRequirePresence()
*/
public function testRequirePresenceAsArray()
{
$validator = new Validator;
$validator = new Validator();
$validator->requirePresence(['title', 'created']);
$this->assertTrue($validator->field('title')->isPresenceRequired());
$this->assertTrue($validator->field('created')->isPresenceRequired());
@@ -237,7 +237,7 @@ public function testRequirePresenceAsArrayFailure()
*/
public function testRequirePresenceCallback()
{
$validator = new Validator;
$validator = new Validator();
$require = true;
$validator->requirePresence('title', function ($context) use (&$require) {
$this->assertEquals([], $context['data']);
@@ -260,7 +260,7 @@ public function testRequirePresenceCallback()
*/
public function testIsPresenceRequired()
{
$validator = new Validator;
$validator = new Validator();
$this->assertSame($validator, $validator->requirePresence('title'));
$this->assertTrue($validator->isPresenceRequired('title', true));
$this->assertTrue($validator->isPresenceRequired('title', false));
@@ -285,7 +285,7 @@ public function testIsPresenceRequired()
*/
public function testErrorsWithPresenceRequired()
{
$validator = new Validator;
$validator = new Validator();
$validator->requirePresence('title');
$errors = $validator->errors(['foo' => 'something']);
$expected = ['title' => ['_required' => 'This field is required']];
@@ -304,7 +304,7 @@ public function testErrorsWithPresenceRequired()
*/
public function testErrorsWithPresenceRequiredOnCreate()
{
$validator = new Validator;
$validator = new Validator();
$validator->requirePresence('id', 'update');
$validator->allowEmpty('id', 'create');
$validator->requirePresence('title');
@@ -438,7 +438,7 @@ public function testErrorsWithNestedManySomeInvalid()
*/
public function testCustomErrorsWithPresenceRequired()
{
$validator = new Validator;
$validator = new Validator();
$validator->requirePresence('title', true, 'Custom message');
$errors = $validator->errors(['foo' => 'something']);
$expected = ['title' => ['_required' => 'Custom message']];
@@ -452,7 +452,7 @@ public function testCustomErrorsWithPresenceRequired()
*/
public function testCustomErrorsWithPresenceRequiredAsArray()
{
$validator = new Validator;
$validator = new Validator();
$validator->requirePresence(['title', 'content'], true, 'Custom message');
$errors = $validator->errors(['foo' => 'something']);
$expected = [
@@ -482,7 +482,7 @@ public function testCustomErrorsWithPresenceRequiredAsArray()
*/
public function testAllowEmpty()
{
$validator = new Validator;
$validator = new Validator();
$this->assertSame($validator, $validator->allowEmpty('title'));
$this->assertTrue($validator->field('title')->isEmptyAllowed());
@@ -500,7 +500,7 @@ public function testAllowEmpty()
*/
public function testAllowEmptyDateTime()
{
$validator = new Validator;
$validator = new Validator();
$validator->allowEmpty('created')
->add('created', 'date', ['rule' => 'date']);
@@ -546,7 +546,7 @@ public function testAllowEmptyDateTime()
*/
public function testAllowEmptyFileFields()
{
$validator = new Validator;
$validator = new Validator();
$validator->allowEmpty('picture')
->add('picture', 'file', ['rule' => 'uploadedFile']);
@@ -580,7 +580,7 @@ public function testAllowEmptyFileFields()
*/
public function testAllowEmptyAsArray()
{
$validator = new Validator;
$validator = new Validator();
$validator->allowEmpty([
'title',
@@ -637,7 +637,7 @@ public function testAllowEmptyAsArrayFailure()
*/
public function testNotEmpty()
{
$validator = new Validator;
$validator = new Validator();
$validator->notEmpty('title');
$this->assertFalse($validator->field('title')->isEmptyAllowed());
@@ -652,7 +652,7 @@ public function testNotEmpty()
*/
public function testNotEmptyAsArray()
{
$validator = new Validator;
$validator = new Validator();
$validator->notEmpty(['title', 'created']);
$this->assertFalse($validator->field('title')->isEmptyAllowed());
$this->assertFalse($validator->field('created')->isEmptyAllowed());
@@ -716,7 +716,7 @@ public function testNotEmptyAsArrayFailure()
*/
public function testNotEmptyModes()
{
$validator = new Validator;
$validator = new Validator();
$validator->notEmpty('title', 'Need a title', 'create');
$this->assertFalse($validator->isEmptyAllowed('title', true));
$this->assertTrue($validator->isEmptyAllowed('title', false));
@@ -741,7 +741,7 @@ public function testNotEmptyModes()
*/
public function testNotEmptyAndIsAllowed()
{
$validator = new Validator;
$validator = new Validator();
$validator->allowEmpty('title')
->notEmpty('title', 'Need it', 'update');
$this->assertTrue($validator->isEmptyAllowed('title', true));
@@ -765,7 +765,7 @@ public function testNotEmptyAndIsAllowed()
*/
public function testAllowEmptyCallback()
{
$validator = new Validator;
$validator = new Validator();
$allow = true;
$validator->allowEmpty('title', function ($context) use (&$allow) {
$this->assertEquals([], $context['data']);
@@ -787,7 +787,7 @@ public function testAllowEmptyCallback()
*/
public function testNotEmptyCallback()
{
$validator = new Validator;
$validator = new Validator();
$prevent = true;
$validator->notEmpty('title', 'error message', function ($context) use (&$prevent) {
$this->assertEquals([], $context['data']);
@@ -809,7 +809,7 @@ public function testNotEmptyCallback()
*/
public function testIsEmptyAllowed()
{
$validator = new Validator;
$validator = new Validator();
$this->assertSame($validator, $validator->allowEmpty('title'));
$this->assertTrue($validator->isEmptyAllowed('title', true));
$this->assertTrue($validator->isEmptyAllowed('title', false));
@@ -834,7 +834,7 @@ public function testIsEmptyAllowed()
*/
public function testErrorsWithEmptyNotAllowed()
{
$validator = new Validator;
$validator = new Validator();
$validator->notEmpty('title');
$errors = $validator->errors(['title' => '']);
$expected = ['title' => ['_empty' => 'This field cannot be left empty']];
@@ -865,7 +865,7 @@ public function testErrorsWithEmptyNotAllowed()
*/
public function testCustomErrorsWithAllowedEmpty()
{
$validator = new Validator;
$validator = new Validator();
$validator->allowEmpty('title', false, 'Custom message');
$errors = $validator->errors(['title' => null]);
$expected = ['title' => ['_empty' => 'Custom message']];
@@ -879,7 +879,7 @@ public function testCustomErrorsWithAllowedEmpty()
*/
public function testCustomErrorsWithEmptyNotAllowed()
{
$validator = new Validator;
$validator = new Validator();
$validator->notEmpty('title', 'Custom message');
$errors = $validator->errors(['title' => '']);
$expected = ['title' => ['_empty' => 'Custom message']];
@@ -893,7 +893,7 @@ public function testCustomErrorsWithEmptyNotAllowed()
*/
public function testErrorsWithEmptyAllowed()
{
$validator = new Validator;
$validator = new Validator();
$validator->allowEmpty('title');
$errors = $validator->errors(['title' => '']);
$this->assertEmpty($errors);
@@ -924,7 +924,7 @@ public function testErrorsWithEmptyAllowed()
*/
public function testProvider()
{
$validator = new Validator;
$validator = new Validator();
$object = new \stdClass;
$this->assertSame($validator, $validator->provider('foo', $object));
$this->assertSame($object, $validator->provider('foo'));
@@ -945,7 +945,7 @@ public function testProvider()
*/
public function testErrorsFromDefaultProvider()
{
$validator = new Validator;
$validator = new Validator();
$validator
->add('email', 'alpha', ['rule' => 'alphanumeric'])
->add('email', 'notBlank', ['rule' => 'notBlank'])
@@ -968,7 +968,7 @@ public function testErrorsFromDefaultProvider()
*/
public function testErrorsFromCustomProvider()
{
$validator = new Validator;
$validator = new Validator();
$validator
->add('email', 'alpha', ['rule' => 'alphanumeric'])
->add('title', 'cool', ['rule' => 'isCool', 'provider' => 'thing']);
@@ -1014,7 +1014,7 @@ public function testErrorsFromCustomProvider()
*/
public function testMethodsWithExtraArguments()
{
$validator = new Validator;
$validator = new Validator();
$validator->add('title', 'cool', [
'rule' => ['isCool', 'and', 'awesome'],
'provider' => 'thing'
@@ -1059,7 +1059,7 @@ public function testMethodsWithExtraArguments()
*/
public function testUsingClosureAsRule()
{
$validator = new Validator;
$validator = new Validator();
$validator->add('name', 'myRule', [
'rule' => function ($data, $provider) {
$this->assertEquals('foo', $data);
@@ -1078,7 +1078,7 @@ public function testUsingClosureAsRule()
*/
public function testErrorsWithLastRule()
{
$validator = new Validator;
$validator = new Validator();
$validator
->add('email', 'alpha', ['rule' => 'alphanumeric', 'last' => true])
->add('email', 'email', ['rule' => 'email', 'message' => 'Y u no write email?']);
@@ -1099,7 +1099,7 @@ public function testErrorsWithLastRule()
*/
public function testArrayAccessGet()
{
$validator = new Validator;
$validator = new Validator();
$validator
->add('email', 'alpha', ['rule' => 'alphanumeric'])
->add('title', 'cool', ['rule' => 'isCool', 'provider' => 'thing']);
@@ -1114,7 +1114,7 @@ public function testArrayAccessGet()
*/
public function testArrayAccessExists()
{
$validator = new Validator;
$validator = new Validator();
$validator
->add('email', 'alpha', ['rule' => 'alphanumeric'])
->add('title', 'cool', ['rule' => 'isCool', 'provider' => 'thing']);
@@ -1130,7 +1130,7 @@ public function testArrayAccessExists()
*/
public function testArrayAccessSet()
{
$validator = new Validator;
$validator = new Validator();
$validator
->add('email', 'alpha', ['rule' => 'alphanumeric'])
->add('title', 'cool', ['rule' => 'isCool', 'provider' => 'thing']);
@@ -1147,7 +1147,7 @@ public function testArrayAccessSet()
*/
public function testArrayAccessUnset()
{
$validator = new Validator;
$validator = new Validator();
$validator
->add('email', 'alpha', ['rule' => 'alphanumeric'])
->add('title', 'cool', ['rule' => 'isCool', 'provider' => 'thing']);
@@ -1163,7 +1163,7 @@ public function testArrayAccessUnset()
*/
public function testCount()
{
$validator = new Validator;
$validator = new Validator();
$validator
->add('email', 'alpha', ['rule' => 'alphanumeric'])
->add('title', 'cool', ['rule' => 'isCool', 'provider' => 'thing']);
@@ -1177,7 +1177,7 @@ public function testCount()
*/
public function testAddMultiple()
{
$validator = new Validator;
$validator = new Validator();
$validator->add('title', [
'notBlank' => [
'rule' => 'notBlank'
@@ -1199,7 +1199,7 @@ public function testAddMultiple()
*/
public function testCompareWithIntegration()
{
$validator = new Validator;
$validator = new Validator();
$validator->add('password', [
'compare' => [
'rule' => ['compareWith', 'password_compare']

0 comments on commit 8e9cf16

Please sign in to comment.
You can’t perform that action at this time.