Skip to content
This repository was archived by the owner on Jan 31, 2020. It is now read-only.

Commit 839966e

Browse files
committed
Merge branch 'hotfix/133'
Closes #133
2 parents c8b36e5 + f940837 commit 839966e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

test/BetweenTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,13 @@ public function testConstructorCanAcceptInclusiveParameter()
139139
$validator = new Between(1, 10, false);
140140
$this->assertFalse($validator->getInclusive());
141141
}
142+
143+
public function testConstructWithTravesableOptions()
144+
{
145+
$options = new \ArrayObject(['min' => 1, 'max' => 10, 'inclusive' => false]);
146+
$validator = new Between($options);
147+
148+
$this->assertTrue($validator->isValid(5));
149+
$this->assertFalse($validator->isValid(10));
150+
}
142151
}

test/BitwiseTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,23 @@ public function testConstruct(array $args, array $options)
3838
$this->assertSame($options['operator'], $validator->getOperator());
3939
$this->assertSame($options['strict'], $validator->getStrict());
4040
}
41+
/**
42+
* @covers \Zend\Validator\Bitwise::__construct()
43+
* @dataProvider constructDataProvider
44+
*
45+
* @param array $args
46+
* @param array $options
47+
*/
48+
public function testConstructWithTravesableOptions(array $args, array $options)
49+
{
50+
$validator = new Bitwise(
51+
new \ArrayObject($args)
52+
);
53+
54+
$this->assertSame($options['control'], $validator->getControl());
55+
$this->assertSame($options['operator'], $validator->getOperator());
56+
$this->assertSame($options['strict'], $validator->getStrict());
57+
}
4158

4259
public function constructDataProvider()
4360
{

0 commit comments

Comments
 (0)