File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -31,4 +31,13 @@ public function value()
31
31
{
32
32
return $ this ->value ;
33
33
}
34
+
35
+ /**
36
+ * Returns the $value property when casting Argument to string
37
+ *
38
+ * @return string
39
+ */
40
+ public function __toString () {
41
+ return (string )$ this ->value ;
42
+ }
34
43
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ use CLILib \Argument ;
3
+ use PHPUnit \Framework \TestCase ;
4
+
5
+ class ArgumentTest extends TestCase
6
+ {
7
+ /**
8
+ * Create Argument object and check Name and Value have been set correctly.
9
+ */
10
+ public function testValidPassArgsToConstructor ()
11
+ {
12
+ $ a = new Argument ("j " , "something " );
13
+
14
+ $ this ->assertEquals ("something " , $ a ->value ());
15
+ $ this ->assertEquals ("j " , $ a ->name ());
16
+
17
+ // Test casting to a string
18
+ $ this ->assertEquals ("something " , (string )$ a );
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments