Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.3.0 Release #16406

Merged
merged 36 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
58585c5
parse multipart/form-data for PUT request
sinbadxiii Jul 27, 2023
582bf57
update changelog
sinbadxiii Jul 28, 2023
60cf4ae
Merge pull request #16387 from sinbadxiii/issue-16271
niden Jul 28, 2023
ebf388d
minor adjustments
niden Nov 18, 2022
0851534
clearing reusable cache on getRelated delete
niden Nov 18, 2022
bdeb25d
fixing cli tests
niden Nov 18, 2022
a7ac0bc
adjusting test
niden Jul 30, 2023
696ea52
correting test
niden Jul 30, 2023
6c65a50
test corrections
niden Jul 30, 2023
d33b505
Merge pull request #16215 from niden/T16214-delete-getrelated
niden Jul 31, 2023
11b830e
adjusting api doc generation
niden Jul 26, 2023
837dcd6
Refactored Model, added Loader::isRegistered [#16391]
rudiservo Aug 6, 2023
f3f6cc8
Fixed Phalcon\Mvc\Model\Metadata::initialize behaviour [#16393]
rudiservo Aug 6, 2023
78694f0
more validation tests
niden Aug 9, 2023
e837d98
fixing changelog
niden Aug 9, 2023
185d627
Added addHeader() in the builder
niden Aug 9, 2023
0725c21
more test coverage for JWT
niden Aug 9, 2023
dbc9102
phpcs
niden Aug 9, 2023
b77710e
phpcs again
niden Aug 9, 2023
e7f9d9c
updating changelog
niden Aug 9, 2023
686960d
Merge pull request #16397 from niden/T16396-jwt-addheader
niden Aug 10, 2023
d09643f
Merge pull request #16392 from rudiservo/5.0.x
Jeckerson Aug 10, 2023
9feaefb
Fix #16343, DynamicUpdate is now enabled system wide
rudiservo Aug 10, 2023
302c38d
Merge pull request #16400 from rudiservo/i16343
niden Aug 12, 2023
05589ec
Remove set of 'application' service
Jeckerson Aug 15, 2023
3fc5700
Remove redundant tests
Jeckerson Aug 15, 2023
cf60c93
Fix typo
Jeckerson Aug 15, 2023
c2ddce6
Update changelog
Jeckerson Aug 15, 2023
3532098
Change next version to `5.3.0`
Jeckerson Aug 15, 2023
60d0829
Change next version to `5.3.0`
Jeckerson Aug 15, 2023
f6f342e
Merge pull request #16404 from phalcon/fix-memory-leak
Jeckerson Aug 15, 2023
ad912e6
prep for 5.3.0
niden Aug 15, 2023
8f5db8e
refreshing ext
niden Aug 15, 2023
a10fb5c
adjusting changelog
niden Aug 15, 2023
b857429
refreshing build files
niden Aug 15, 2023
df62245
Merge pull request #16405 from niden/5.0.x
Jeckerson Aug 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more validation tests
  • Loading branch information
niden committed Aug 9, 2023
commit 78694f00c0951e1382142bf5f6a805c564c6a191
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,38 @@

use IntegrationTester;
use Phalcon\Filter\Validation;
use Phalcon\Filter\Validation\Exception;
use Phalcon\Filter\Validation\Validator\Alnum;
use stdClass;

class ValidateCest
{
/**
* Tests Phalcon\Filter\Validation\Validator\Alnum :: validate() - empty
*
* @param IntegrationTester $I
*
* @return void
* @throws Exception
*
* @author Phalcon Team <team@phalcon.io>
* @since 2023-08-03
*/
public function filterValidationValidatorAlnumValidateEmpty(IntegrationTester $I)
{
$I->wantToTest("Validation\Validator\Alnum - validate() - empty");

$validation = new Validation();
$validator = new Alnum(['allowEmpty' => true,]);
$validation->add('name', $validator);
$entity = new stdClass();
$entity->name = '';

$validation->bind($entity, []);
$result = $validator->validate($validation, 'name');
$I->assertTrue($result);
}

/**
* Tests Phalcon\Filter\Validation\Validator\Alnum :: validate() - single field
*
Expand All @@ -30,33 +58,27 @@ public function filterValidationValidatorAlnumValidateSingleField(IntegrationTes
$I->wantToTest("Validation\Validator\Alnum - validate() - single field");

$validation = new Validation();

$validation->add(
'name',
new Alnum()
);
$validation->add('name', new Alnum());

$messages = $validation->validate(
[
'name' => 'SomeValue123',
]
);

$I->assertEquals(
0,
$messages->count()
);
$expected = 0;
$actual = $messages->count();
$I->assertSame($expected, $actual);

$messages = $validation->validate(
[
'name' => 'SomeValue123!@#',
]
);

$I->assertEquals(
1,
$messages->count()
);
$expected = 1;
$actual = $messages->count();
$I->assertSame($expected, $actual);
}

/**
Expand All @@ -67,7 +89,7 @@ public function filterValidationValidatorAlnumValidateSingleField(IntegrationTes
*/
public function filterValidationValidatorAlnumValidateMultipleField(IntegrationTester $I)
{
$I->wantToTest("Validation\Validator\Alnum - validate() - multiple field");
$I->wantToTest("Validation\Validator\Alnum - validate() - multiple fields");

$validation = new Validation();

Expand All @@ -90,22 +112,16 @@ public function filterValidationValidatorAlnumValidateMultipleField(IntegrationT
$al
);

codecept_debug($validation);
codecept_debug($al);


$messages = $validation->validate(
[
'name' => 'SomeValue123',
'type' => 'SomeValue123',
]
);

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

$expected = 0;
$actual = $messages->count();
$I->assertSame($expected, $actual);

$messages = $validation->validate(
[
Expand All @@ -114,16 +130,13 @@ public function filterValidationValidatorAlnumValidateMultipleField(IntegrationT
]
);

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

$I->assertEquals(
$validationMessages['name'],
$messages->offsetGet(0)->getMessage()
);
$expected = 1;
$actual = $messages->count();
$I->assertSame($expected, $actual);

$expected = $validationMessages['name'];
$actual = $messages->offsetGet(0)->getMessage();
$I->assertSame($expected, $actual);

$messages = $validation->validate(
[
Expand All @@ -132,19 +145,16 @@ public function filterValidationValidatorAlnumValidateMultipleField(IntegrationT
]
);

$I->assertEquals(
2,
$messages->count()
);
$expected = 2;
$actual = $messages->count();
$I->assertSame($expected, $actual);

$I->assertEquals(
$validationMessages['name'],
$messages->offsetGet(0)->getMessage()
);
$expected = $validationMessages['name'];
$actual = $messages->offsetGet(0)->getMessage();
$I->assertSame($expected, $actual);

$I->assertEquals(
$validationMessages['type'],
$messages->offsetGet(1)->getMessage()
);
$expected = $validationMessages['type'];
$actual = $messages->offsetGet(1)->getMessage();
$I->assertSame($expected, $actual);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,40 @@
use Codeception\Example;
use IntegrationTester;
use Phalcon\Filter\Validation;
use Phalcon\Filter\Validation\Exception;
use Phalcon\Filter\Validation\Validator\Alpha;
use Phalcon\Messages\Message;
use Phalcon\Messages\Messages;
use stdClass;

class ValidateCest
{
/**
* Tests Phalcon\Filter\Validation\Validator\Alpha :: validate() - empty
*
* @param IntegrationTester $I
*
* @return void
* @throws Exception
*
* @author Phalcon Team <team@phalcon.io>
* @since 2023-08-03
*/
public function filterValidationValidatorAlphaValidateEmpty(IntegrationTester $I)
{
$I->wantToTest("Validation\Validator\Alpha - validate() - empty");

$validation = new Validation();
$validator = new Alpha(['allowEmpty' => true,]);
$validation->add('name', $validator);
$entity = new stdClass();
$entity->name = '';

$validation->bind($entity, []);
$result = $validator->validate($validation, 'name');
$I->assertTrue($result);
}

/**
* Tests Phalcon\Filter\Validation\Validator\Alpha :: validate() - single field
*
Expand All @@ -46,7 +74,7 @@ public function filterValidationValidatorAlphaValidateSingleField(IntegrationTes
]
);

$I->assertEquals(
$I->assertSame(
0,
$messages->count()
);
Expand All @@ -58,7 +86,7 @@ public function filterValidationValidatorAlphaValidateSingleField(IntegrationTes
]
);

$I->assertEquals(
$I->assertSame(
1,
$messages->count()
);
Expand Down Expand Up @@ -98,7 +126,7 @@ public function filterValidationValidatorAlphaValidateMultipleField(IntegrationT
]
);

$I->assertEquals(
$I->assertSame(
0,
$messages->count()
);
Expand All @@ -111,12 +139,12 @@ public function filterValidationValidatorAlphaValidateMultipleField(IntegrationT
]
);

$I->assertEquals(
$I->assertSame(
1,
$messages->count()
);

$I->assertEquals(
$I->assertSame(
$validationMessages['name'],
$messages->offsetGet(0)->getMessage()
);
Expand All @@ -129,17 +157,17 @@ public function filterValidationValidatorAlphaValidateMultipleField(IntegrationT
]
);

$I->assertEquals(
$I->assertSame(
2,
$messages->count()
);

$I->assertEquals(
$I->assertSame(
$validationMessages['name'],
$messages->offsetGet(0)->getMessage()
);

$I->assertEquals(
$I->assertSame(
$validationMessages['type'],
$messages->offsetGet(1)->getMessage()
);
Expand Down Expand Up @@ -225,7 +253,7 @@ public function filterValidationValidatorAlphaValidateAlphabeticCharacters(Integ
]
);

$I->assertEquals(
$I->assertSame(
0,
$messages->count()
);
Expand Down Expand Up @@ -263,7 +291,7 @@ public function filterValidationValidatorAlphaValidateNonLatinCharacters(Integra
]
);

$I->assertEquals(
$I->assertSame(
0,
$messages->count()
);
Expand Down
Loading