Skip to content

Commit ee9e697

Browse files
committed
Merge branch '1.0' into 1.1
2 parents 22f1f14 + c931e25 commit ee9e697

13 files changed

+29
-543
lines changed

composer.json

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
},
1818
"require-dev": {
1919
"egulias/email-validator": "~1.2",
20-
"malkusch/bav": "~1.0",
2120
"mikey179/vfsStream": "^1.5",
2221
"phpunit/phpunit": "~4.0",
2322
"symfony/validator": "~2.6.9",
@@ -27,7 +26,6 @@
2726
"ext-bcmath": "Arbitrary Precision Mathematics",
2827
"ext-mbstring": "Multibyte String Functions",
2928
"egulias/email-validator": "Strict (RFC compliant) email validation",
30-
"malkusch/bav": "German bank account validation",
3129
"symfony/validator": "Use Symfony validator through Respect\\Validation",
3230
"zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation",
3331
"fabpot/php-cs-fixer": "Fix PSR2 and other coding style issues"

library/Exceptions/ValidationException.php

+3
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ public function hasCustomTemplate()
305305
public function setTemplate($template)
306306
{
307307
$this->customTemplate = true;
308+
if (isset(static::$defaultTemplates[$this->mode][$template])) {
309+
$template = static::$defaultTemplates[$this->mode][$template];
310+
}
308311
$this->template = $template;
309312

310313
$this->buildMessage();

library/Rules/Domain.php

+6-10
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,12 @@ public function __construct($tldCheck = true)
2929
new Alnum('-'),
3030
new Not(new StartsWith('-')),
3131
new OneOf(
32-
new Not(
33-
new Contains('--')
34-
),
35-
new AllOf(
36-
new StartsWith('xn--'),
37-
new Callback(function ($str) {
38-
return substr_count($str, '--') == 1;
39-
})
40-
)
41-
)
32+
new Not(new Contains('--')),
33+
new Callback(function ($str) {
34+
return substr_count($str, '--') == 1;
35+
})
36+
),
37+
new Not(new EndsWith('-'))
4238
);
4339
}
4440

tests/integration/issue-739.phpt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--FILE--
2+
<?php
3+
4+
require 'vendor/autoload.php';
5+
6+
use Respect\Validation\Exceptions\ValidationException;
7+
use Respect\Validation\Validator as v;
8+
9+
try {
10+
v::when(v::alwaysInvalid(), v::alwaysValid())->check('foo');
11+
} catch (ValidationException $exception) {
12+
echo $exception->getMainMessage();
13+
}
14+
?>
15+
--EXPECT--
16+
"foo" is not valid

tests/library/Rules/LocaleTestCase.php

-39
This file was deleted.

tests/unit/Rules/BankAccountTest.php

-47
This file was deleted.

tests/unit/Rules/BankTest.php

-45
This file was deleted.

tests/unit/Rules/BicTest.php

-45
This file was deleted.

tests/unit/Rules/DomainTest.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ public function providerForDomain()
6767
['xn--bcher-kva.ch'],
6868
['mail.xn--bcher-kva.ch'],
6969
['example-hyphen.com'],
70+
['example--valid.com'],
71+
['std--a.com'],
72+
['r--w.com'],
7073
];
7174
}
7275

@@ -76,10 +79,10 @@ public function providerForNotDomain()
7679
[null],
7780
[''],
7881
['2222222domain.local'],
79-
['example--invalid.com'],
8082
['-example-invalid.com'],
8183
['example.invalid.-com'],
8284
['xn--bcher--kva.ch'],
85+
['example.invalid-.com'],
8386
['1.2.3.256'],
8487
['1.2.3.4'],
8588
];

tests/unit/Rules/Locale/FactoryTest.php

-92
This file was deleted.

0 commit comments

Comments
 (0)