Skip to content

Commit

Permalink
Added parentheses to the class calls
Browse files Browse the repository at this point in the history
  • Loading branch information
David Yell committed May 5, 2017
1 parent bb9e73e commit 8e9cf16
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions tests/TestCase/Validation/ValidatorTest.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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');
Expand All @@ -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'));
Expand All @@ -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'));
Expand All @@ -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());

Expand All @@ -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());
Expand Down Expand Up @@ -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']);
Expand All @@ -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));
Expand All @@ -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']];
Expand All @@ -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');
Expand Down Expand Up @@ -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']];
Expand All @@ -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 = [
Expand Down Expand Up @@ -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());

Expand All @@ -500,7 +500,7 @@ public function testAllowEmpty()
*/
public function testAllowEmptyDateTime()
{
$validator = new Validator;
$validator = new Validator();
$validator->allowEmpty('created')
->add('created', 'date', ['rule' => 'date']);

Expand Down Expand Up @@ -546,7 +546,7 @@ public function testAllowEmptyDateTime()
*/
public function testAllowEmptyFileFields()
{
$validator = new Validator;
$validator = new Validator();
$validator->allowEmpty('picture')
->add('picture', 'file', ['rule' => 'uploadedFile']);

Expand Down Expand Up @@ -580,7 +580,7 @@ public function testAllowEmptyFileFields()
*/
public function testAllowEmptyAsArray()
{
$validator = new Validator;
$validator = new Validator();

$validator->allowEmpty([
'title',
Expand Down Expand Up @@ -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());

Expand All @@ -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());
Expand Down Expand Up @@ -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));
Expand All @@ -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));
Expand All @@ -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']);
Expand All @@ -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']);
Expand All @@ -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));
Expand All @@ -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']];
Expand Down Expand Up @@ -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']];
Expand All @@ -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']];
Expand All @@ -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);
Expand Down Expand Up @@ -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'));
Expand All @@ -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'])
Expand All @@ -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']);
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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);
Expand All @@ -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?']);
Expand All @@ -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']);
Expand All @@ -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']);
Expand All @@ -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']);
Expand All @@ -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']);
Expand All @@ -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']);
Expand All @@ -1177,7 +1177,7 @@ public function testCount()
*/
public function testAddMultiple()
{
$validator = new Validator;
$validator = new Validator();
$validator->add('title', [
'notBlank' => [
'rule' => 'notBlank'
Expand All @@ -1199,7 +1199,7 @@ public function testAddMultiple()
*/
public function testCompareWithIntegration()
{
$validator = new Validator;
$validator = new Validator();
$validator->add('password', [
'compare' => [
'rule' => ['compareWith', 'password_compare']
Expand Down

0 comments on commit 8e9cf16

Please sign in to comment.