Skip to content

Conversation

@suralc
Copy link
Contributor

@suralc suralc commented Jul 29, 2013

Begun to write some tests for the validators.

I'll add additional tests in the comming days. I just opened this PR, that no duplicate work is made.

@coveralls
Copy link

Coverage Status

Coverage increased (+0%) when pulling ec1dfea on suralc:add-tests into 1e0decf on yiisoft:master.

@qiangxue
Copy link
Member

Thank you for adding test cases. Your effort is greatly appreciated!

Why adding @codeCoverageIgnore to clientValidateAttribute()? I think we still need to test them, somehow, in future.

@suralc
Copy link
Contributor Author

suralc commented Jul 29, 2013

Yes, we need to, but I couldn't think of a clean solution to do this, without tapping into view or asset management to deep for now, I'll focus on the other tests and remove that tag later.

@coveralls
Copy link

Coverage Status

Coverage increased (+0%) when pulling 777ff79 on suralc:add-tests into 1e0decf on yiisoft:master.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 467d88f on suralc:add-tests into * on yiisoft:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 467d88f on suralc:add-tests into * on yiisoft:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling f7bb54b on suralc:add-tests into * on yiisoft:master*.

@suralc
Copy link
Contributor Author

suralc commented Aug 13, 2013

Sorry for the long delay, I'll add the remaining tests asap (this week)

@qiangxue
Copy link
Member

No problem. Your contribution is always welcome. Thank you. 👍

@suralc
Copy link
Contributor Author

suralc commented Aug 13, 2013

@qiangxue
Just a question:

If a validator is not associated with any attributes it will raise a php-error if Validator::validate($object) is called. Situation may never occur in user-code as there will be an exception earlier in Model::createValidators(). However, if a validator is created by hand and one use it via Validator::validate($obj) he might run into this undeclarative error:

1) yiiunit\framework\validators\ValidatorTest::testValidateWithEmptyAttributes
Invalid argument(null) supplied for foreach()

D:\dev\www\vhosts\yii2\framework\yii\validators\Validator.php:180

Should this stay as is, or raise an exception?

@qiangxue
Copy link
Member

Fixed in 1ca215d

@cebe
Copy link
Member

cebe commented Aug 13, 2013

Should this stay as is, or raise an exception?

I think Validator::$attributes should be empty array by default

@cebe
Copy link
Member

cebe commented Aug 13, 2013

@qiangxue :-D great, same thought in same second ;)

@suralc
Copy link
Contributor Author

suralc commented Aug 13, 2013

Would be the most obvious ;) Thanks

@coveralls
Copy link

Coverage Status

Coverage increased (+0%) when pulling 02c92fe on suralc:add-tests into 90ddea1 on yiisoft:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0%) when pulling 0133069 on suralc:add-tests into 6e32fae on yiisoft:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 4727049c3a364b18a590a7ee8e3edc20868207fe on suralc:add-tests into 6e32fae on yiisoft:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0%) when pulling 4ffffec328931f85ad2b07c8a5fe794081869fcb on suralc:add-tests into 6e32fae on yiisoft:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 5c8927a on suralc:add-tests into 9a9a9c0 on yiisoft:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 5c8927a on suralc:add-tests into 9a9a9c0 on yiisoft:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 3b07e4a on suralc:add-tests into 9a9a9c0 on yiisoft:master.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about naming, or if this is to be avoided.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we don't need it. You can assign ActiveRecord::$db with $this->getConnection(), like ActiveRecordTest.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.73%) when pulling c336c7b2b83234a2480cffd0135da3de711f2bc3 on suralc:add-tests into 9a9a9c0 on yiisoft:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 06682d0 on suralc:add-tests into f3cd755 on yiisoft:master.

@cebe
Copy link
Member

cebe commented Sep 18, 2013

@suralc thanks for the great work in here. can you tell whats missing?

@ghost ghost assigned samdark Oct 14, 2013
@samdark samdark merged commit 06682d0 into yiisoft:master Oct 14, 2013
@samdark
Copy link
Member

samdark commented Oct 14, 2013

Updated and merged. @suralc thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants