Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
76081664
Commit
76081664
authored
Aug 15, 2006
by
pookey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Empty values now pass email validator
parent
f5e54ad7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
9 deletions
+10
-9
Validator.php
Doctrine/Validator.php
+0
-6
Email.php
Doctrine/Validator/Email.php
+3
-0
ValidatorTestCase.php
tests/ValidatorTestCase.php
+3
-1
classes.php
tests/classes.php
+2
-0
run.php
tests/run.php
+2
-2
No files found.
Doctrine/Validator.php
View file @
76081664
...
...
@@ -183,12 +183,6 @@ class Doctrine_Validator {
break
;
}
}
/**
if(self::gettype($value) !== $column[0] && self::gettype($value) != 'NULL') {
$err[$key] = Doctrine_Validator::ERR_TYPE;
continue;
}
*/
if
(
!
self
::
isValidType
(
$value
,
$column
[
0
]))
{
$err
[
$key
]
=
Doctrine_Validator
::
ERR_TYPE
;
continue
;
...
...
Doctrine/Validator/Email.php
View file @
76081664
...
...
@@ -8,6 +8,9 @@ class Doctrine_Validator_Email {
* @return boolean
*/
public
function
validate
(
Doctrine_Record
$record
,
$key
,
$value
,
$args
)
{
if
(
empty
(
$value
))
return
true
;
$parts
=
explode
(
"@"
,
$value
);
if
(
count
(
$parts
)
!=
2
)
...
...
tests/ValidatorTestCase.php
View file @
76081664
...
...
@@ -81,7 +81,9 @@ class Doctrine_ValidatorTestCase extends Doctrine_UnitTestCase {
$this
->
assertTrue
(
is_array
(
$stack
));
$stack
=
$stack
[
'Validator_Test'
][
0
];
$this
->
assertEqual
(
$stack
[
'mystring'
],
Doctrine_Validator
::
ERR_NOTNULL
);
$this
->
assertEqual
(
$stack
[
'myemail2'
],
Doctrine_Validator
::
ERR_NOTBLANK
);
$test
->
mystring
=
'str'
;
...
...
@@ -137,7 +139,7 @@ class Doctrine_ValidatorTestCase extends Doctrine_UnitTestCase {
}
public
function
testSave
()
{
$this
->
manager
->
setAttribute
(
Doctrine
::
ATTR_VLD
,
true
);
$user
=
$this
->
session
->
getTable
(
"User"
)
->
find
(
4
);
$user
=
$this
->
session
->
getTable
(
"User"
)
->
find
(
4
);
try
{
$user
->
name
=
"this is an example of too long name not very good example but an example nevertheless"
;
$user
->
save
();
...
...
tests/classes.php
View file @
76081664
...
...
@@ -382,6 +382,8 @@ class Validator_Test extends Doctrine_Record {
$this
->
hasColumn
(
"myarray"
,
"array"
,
1000
);
$this
->
hasColumn
(
"myobject"
,
"object"
,
1000
);
$this
->
hasColumn
(
"myinteger"
,
"integer"
,
11
);
$this
->
hasColumn
(
"myemail"
,
"string"
,
100
,
"email"
);
$this
->
hasColumn
(
"myemail2"
,
"string"
,
100
,
"email|notblank"
);
}
}
?>
tests/run.php
View file @
76081664
...
...
@@ -34,8 +34,6 @@ $test->addTestCase(new Doctrine_SessionTestCase());
$test
->
addTestCase
(
new
Doctrine_TableTestCase
());
$test
->
addTestCase
(
new
Doctrine_ValidatorTestCase
());
$test
->
addTestCase
(
new
Doctrine_ManagerTestCase
());
$test
->
addTestCase
(
new
Doctrine_AccessTestCase
());
...
...
@@ -65,6 +63,8 @@ $test->addTestCase(new Doctrine_CustomPrimaryKeyTestCase());
$test
->
addTestCase
(
new
Doctrine_Filter_TestCase
());
$test
->
addTestCase
(
new
Doctrine_ValueHolder_TestCase
());
$test
->
addTestCase
(
new
Doctrine_ValidatorTestCase
());
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment