forked from symfony/symfony
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 2.3: Improved the PHPdoc of FileSystem::copy() [Validator] Test DNS Email constraints using checkdnsrr() mock [travis] Run real php subprocesses on hhvm for Process component tests bug symfony#18161 [Translation] Add support for fuzzy tags in PoFileLoader [Form] Fix NumberToLocalizedStringTransformer::reverseTransform with big integers [Form] Fix INT64 cast to float in IntegerType. [SecurityBundle][PHPDoc] Added method doumentation for SecurityFactoryInterface FrameworkBundle: Client: getContainer(): fixed phpdoc [Validator] Updating inaccurate docblock comment Conflicts: .travis.yml src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php
- Loading branch information
Showing
16 changed files
with
132 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/Symfony/Component/Translation/Tests/fixtures/fuzzy-translations.po
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#, php-format | ||
msgid "foo1" | ||
msgstr "bar1" | ||
|
||
#, fuzzy, php-format | ||
msgid "foo2" | ||
msgstr "fuzzy bar2" | ||
|
||
msgid "foo3" | ||
msgstr "bar3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,14 @@ | |
|
||
namespace Symfony\Component\Validator\Tests\Constraints; | ||
|
||
use Symfony\Bridge\PhpUnit\DnsMock; | ||
use Symfony\Component\Validator\Constraints\Email; | ||
use Symfony\Component\Validator\Constraints\EmailValidator; | ||
use Symfony\Component\Validator\Validation; | ||
|
||
/** | ||
* @group dns-sensitive | ||
*/ | ||
class EmailValidatorTest extends AbstractConstraintValidatorTest | ||
{ | ||
protected function getApiVersion() | ||
|
@@ -103,4 +107,40 @@ public function testStrict() | |
|
||
$this->assertNoViolation(); | ||
} | ||
|
||
/** | ||
* @dataProvider getDnsChecks | ||
*/ | ||
public function testDnsChecks($type, $violation) | ||
{ | ||
DnsMock::withMockedHosts(array('example.com' => array(array('type' => $violation ? false : $type)))); | ||
|
||
$constraint = new Email(array( | ||
'message' => 'myMessage', | ||
'MX' === $type ? 'checkMX' : 'checkHost' => true, | ||
)); | ||
|
||
$this->validator->validate('[email protected]', $constraint); | ||
|
||
if (!$violation) { | ||
$this->assertNoViolation(); | ||
} else { | ||
$this->buildViolation('myMessage') | ||
->setParameter('{{ value }}', '"[email protected]"') | ||
->setCode($violation) | ||
->assertRaised(); | ||
} | ||
} | ||
|
||
public function getDnsChecks() | ||
{ | ||
return array( | ||
array('MX', false), | ||
array('MX', Email::MX_CHECK_FAILED_ERROR), | ||
array('A', false), | ||
array('A', Email::HOST_CHECK_FAILED_ERROR), | ||
array('AAAA', false), | ||
array('AAAA', Email::HOST_CHECK_FAILED_ERROR), | ||
); | ||
} | ||
} |