This repository was archived by the owner on Sep 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Tests/Unit/AutoRoute/PathProvider Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,25 @@ public function testProvideMethodWithAbsolute()
115
115
$ this ->provider ->init (array ('method ' => 'getAbsoluteSlug ' ));
116
116
$ this ->provider ->providePath ($ this ->routeStack );
117
117
}
118
+
119
+ public function testProvideMethodObjectToString ()
120
+ {
121
+ $ this ->setupTest ();
122
+
123
+ $ this ->provider ->init (array ('method ' => 'getStringObjectSlug ' ));
124
+ $ this ->provider ->providePath ($ this ->routeStack );
125
+ }
126
+
127
+ /**
128
+ * @expectedException \RunTimeException
129
+ */
130
+ public function testProvideMethodWrongType ()
131
+ {
132
+ $ this ->setupTest ();
133
+
134
+ $ this ->provider ->init (array ('method ' => 'getWrongTypeSlug ' ));
135
+ $ this ->provider ->providePath ($ this ->routeStack );
136
+ }
118
137
}
119
138
120
139
class ContentMethodTestClass
@@ -134,4 +153,22 @@ public function getAbsoluteSlug()
134
153
return '/this/is/absolute ' ;
135
154
}
136
155
156
+ public function getStringObjectSlug ()
157
+ {
158
+ return new StringObject ();
159
+ }
160
+
161
+ public function getWrongTypeSlug ()
162
+ {
163
+ return new \StdClass ();
164
+ }
165
+
166
+ }
167
+
168
+ class StringObject
169
+ {
170
+ public function __toString ()
171
+ {
172
+ return 'this/is/from/an/object ' ;
173
+ }
137
174
}
You can’t perform that action at this time.
0 commit comments