Skip to content

Commit f205637

Browse files
committed
Add ValidIranPostalCodeTest
1 parent 1cc11aa commit f205637

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace Milwad\LaravelValidate\Tests\Rules;
4+
5+
use Milwad\LaravelValidate\Rules\ValidIranPostalCode;
6+
use Milwad\LaravelValidate\Tests\BaseTest;
7+
8+
class ValidIranPostalCodeTest extends BaseTest
9+
{
10+
/**
11+
* Set up.
12+
*/
13+
protected function setUp(): void
14+
{
15+
parent::setUp();
16+
}
17+
18+
/**
19+
* Test postal code is valid.
20+
*
21+
* @test
22+
*
23+
* @return void
24+
*/
25+
public function postal_code_is_valid()
26+
{
27+
$rules = ['postal_code' => [new ValidIranPostalCode()]];
28+
$data = ['postal_code' => '3354355599'];
29+
$passes = $this->app['validator']->make($data, $rules)->passes();
30+
31+
$this->assertTrue($passes);
32+
}
33+
34+
/**
35+
* Test postal code is not valid.
36+
*
37+
* @test
38+
*
39+
* @return void
40+
*/
41+
public function postal_code_is_not_valid()
42+
{
43+
$rules = ['postal_code' => [new ValidIranPostalCode()]];
44+
$data = ['postal_code' => '1111111111'];
45+
$passes = $this->app['validator']->make($data, $rules)->passes();
46+
47+
$this->assertFalse($passes);
48+
}
49+
}

0 commit comments

Comments
 (0)