File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed
Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,12 @@ final public function copy()
2121 }
2222
2323 /**
24- * Gets the value for the specified option name. Returns the specified
25- * default value if option name is not set .
24+ * Gets the value for the specified option name. When option name is not set the default value is retrieved, if
25+ * defined, otherwise null .
2626 *
2727 * @param string $option Option name.
2828 *
29- * @return mixed Option value or default value.
29+ * @return mixed Option value, default value or null .
3030 */
3131 final protected function get ($ option )
3232 {
Original file line number Diff line number Diff line change @@ -24,4 +24,9 @@ public function removeFooKey($child)
2424 {
2525 unset($ this ->getReference ('foo ' )[$ child ]);
2626 }
27+
28+ public function getBar ()
29+ {
30+ return $ this ->get ('bar ' );
31+ }
2732}
Original file line number Diff line number Diff line change 33
44use ScriptFUSIONTest \Stubs \TestOptions ;
55
6+ /**
7+ * @see TestOptions
8+ */
69final class EncapsulatedOptionsTest extends \PHPUnit_Framework_TestCase
710{
8- /** @var TestOptions */
11+ /**
12+ * @var TestOptions
13+ */
914 private $ options ;
1015
1116 protected function setUp ()
@@ -49,4 +54,12 @@ public function testGetReference()
4954
5055 self ::assertSame (['baz ' => 'baz ' ], $ this ->options ->getFoo ());
5156 }
57+
58+ /**
59+ * Tests that getting a value that is neither set nor has a default defined returns null.
60+ */
61+ public function testGetUnset ()
62+ {
63+ self ::assertNull ($ this ->options ->getBar ());
64+ }
5265}
You can’t perform that action at this time.
0 commit comments