Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit b5f67ef

Browse files
wouterjdantleech
authored andcommitted
Added tests
1 parent 52561a2 commit b5f67ef

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Tests/Unit/AutoRoute/PathProvider/ContentMethodProviderTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,25 @@ public function testProvideMethodWithAbsolute()
115115
$this->provider->init(array('method' => 'getAbsoluteSlug'));
116116
$this->provider->providePath($this->routeStack);
117117
}
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+
}
118137
}
119138

120139
class ContentMethodTestClass
@@ -134,4 +153,22 @@ public function getAbsoluteSlug()
134153
return '/this/is/absolute';
135154
}
136155

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+
}
137174
}

0 commit comments

Comments
 (0)