This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/options-process_array'
- Loading branch information
45 parents
dbfb1b8
+
ccab83f
+
00b350f
+
78945d0
+
f0e5f4b
+
ceb7d8c
+
9e124d1
+
3de5912
+
b6a974a
+
10a6438
+
cb6c1e7
+
18afd6c
+
3baf1bd
+
c800904
+
f52dcb8
+
126ccb2
+
e7d6206
+
e2d24ab
+
ec1abfc
+
290ea90
+
9f4ca1b
+
edaa760
+
c4c0c95
+
d21f055
+
5b18029
+
e6b97af
+
010fb36
+
64c7b8d
+
636523e
+
4cc2cd6
+
e34098a
+
16367cd
+
943c77f
+
8226e5b
+
0b47726
+
3cd8a03
+
cc4782c
+
9c653a6
+
656dbe5
+
9bce1ba
+
7dc18ca
+
861130d
+
2d2ffbd
+
4f413a5
+
a8b0761
commit 4c554ee
Showing
3 changed files
with
82 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace ZendTest\Stdlib; | ||
|
||
use ArrayObject, | ||
ZendTest\Stdlib\TestAsset\TestOptions, | ||
ZendTest\Stdlib\TestAsset\TestTraversable, | ||
Zend\Stdlib\Exception\InvalidArgumentException; | ||
|
||
class OptionsTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testConstructionWithArray() | ||
{ | ||
$options = new TestOptions(array('test_field' => 1)); | ||
|
||
$this->assertEquals(1, $options->test_field); | ||
} | ||
|
||
public function testConstructionWithTraversable() | ||
{ | ||
$config = new ArrayObject(array('test_field' => 1)); | ||
$options = new TestOptions($config); | ||
|
||
$this->assertEquals(1, $options->test_field); | ||
} | ||
|
||
public function testConstructionWithNull() | ||
{ | ||
try { | ||
$options = new TestOptions(null); | ||
} catch(InvalidArgumentException $e) { | ||
$this->fail("Unexpected InvalidArgumentException raised"); | ||
} | ||
} | ||
|
||
public function testUnsetting() | ||
{ | ||
$options = new TestOptions(array('test_field' => 1)); | ||
|
||
$this->assertEquals(true, isset($options->test_field)); | ||
unset($options->testField); | ||
$this->assertEquals(false, isset($options->test_field)); | ||
|
||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace ZendTest\Stdlib\TestAsset; | ||
|
||
use Zend\Stdlib\Options; | ||
|
||
/** | ||
* Dummy TestOptions used to test Stdlib\Options | ||
*/ | ||
class TestOptions extends Options | ||
{ | ||
protected $testField; | ||
|
||
public function setTestField($value) | ||
{ | ||
$this->testField = $value; | ||
} | ||
|
||
public function getTestField() | ||
{ | ||
return $this->testField; | ||
} | ||
} |