Skip to content

Commit

Permalink
Merge branch '1.0' into 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquemoody committed Jan 2, 2018
2 parents 22f1f14 + c931e25 commit ee9e697
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 543 deletions.
2 changes: 0 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"require-dev": {
"egulias/email-validator": "~1.2",
"malkusch/bav": "~1.0",
"mikey179/vfsStream": "^1.5",
"phpunit/phpunit": "~4.0",
"symfony/validator": "~2.6.9",
Expand All @@ -27,7 +26,6 @@
"ext-bcmath": "Arbitrary Precision Mathematics",
"ext-mbstring": "Multibyte String Functions",
"egulias/email-validator": "Strict (RFC compliant) email validation",
"malkusch/bav": "German bank account validation",
"symfony/validator": "Use Symfony validator through Respect\\Validation",
"zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation",
"fabpot/php-cs-fixer": "Fix PSR2 and other coding style issues"
Expand Down
3 changes: 3 additions & 0 deletions library/Exceptions/ValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ public function hasCustomTemplate()
public function setTemplate($template)
{
$this->customTemplate = true;
if (isset(static::$defaultTemplates[$this->mode][$template])) {
$template = static::$defaultTemplates[$this->mode][$template];
}
$this->template = $template;

$this->buildMessage();
Expand Down
16 changes: 6 additions & 10 deletions library/Rules/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,12 @@ public function __construct($tldCheck = true)
new Alnum('-'),
new Not(new StartsWith('-')),
new OneOf(
new Not(
new Contains('--')
),
new AllOf(
new StartsWith('xn--'),
new Callback(function ($str) {
return substr_count($str, '--') == 1;
})
)
)
new Not(new Contains('--')),
new Callback(function ($str) {
return substr_count($str, '--') == 1;
})
),
new Not(new EndsWith('-'))
);
}

Expand Down
16 changes: 16 additions & 0 deletions tests/integration/issue-739.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--FILE--
<?php

require 'vendor/autoload.php';

use Respect\Validation\Exceptions\ValidationException;
use Respect\Validation\Validator as v;

try {
v::when(v::alwaysInvalid(), v::alwaysValid())->check('foo');
} catch (ValidationException $exception) {
echo $exception->getMainMessage();
}
?>
--EXPECT--
"foo" is not valid
39 changes: 0 additions & 39 deletions tests/library/Rules/LocaleTestCase.php

This file was deleted.

47 changes: 0 additions & 47 deletions tests/unit/Rules/BankAccountTest.php

This file was deleted.

45 changes: 0 additions & 45 deletions tests/unit/Rules/BankTest.php

This file was deleted.

45 changes: 0 additions & 45 deletions tests/unit/Rules/BicTest.php

This file was deleted.

5 changes: 4 additions & 1 deletion tests/unit/Rules/DomainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public function providerForDomain()
['xn--bcher-kva.ch'],
['mail.xn--bcher-kva.ch'],
['example-hyphen.com'],
['example--valid.com'],
['std--a.com'],
['r--w.com'],
];
}

Expand All @@ -76,10 +79,10 @@ public function providerForNotDomain()
[null],
[''],
['2222222domain.local'],
['example--invalid.com'],
['-example-invalid.com'],
['example.invalid.-com'],
['xn--bcher--kva.ch'],
['example.invalid-.com'],
['1.2.3.256'],
['1.2.3.4'],
];
Expand Down
92 changes: 0 additions & 92 deletions tests/unit/Rules/Locale/FactoryTest.php

This file was deleted.

Loading

0 comments on commit ee9e697

Please sign in to comment.