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

Commit 50526de

Browse files
committed
Added test for format option
1 parent f843523 commit 50526de

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Tests/Unit/AutoRoute/PathExists/AutoIncrementPathTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,44 @@ public function testAutoIncrement($testUpdate)
9999
$this->aiPath->execute($this->routeStack);
100100
}
101101

102+
public function testFormatOption()
103+
{
104+
$this->routeStack->expects($this->once())
105+
->method('getFullPath')
106+
->will($this->returnValue('/foo/bar'));
107+
108+
$this->routeStack->expects($this->once())
109+
->method('getContext')
110+
->will($this->returnValue($this->builderContext));
111+
112+
$this->dm->expects($this->at(0))
113+
->method('find')
114+
->with(null, '/foo/bar')
115+
->will($this->returnValue($this->route1));
116+
117+
$this->route1->expects($this->once())
118+
->method('getContent')
119+
->will($this->returnValue($this->content1));
120+
121+
$this->builderContext->expects($this->once())
122+
->method('getContent')
123+
->will($this->returnValue($this->content2));
124+
125+
$this->dm->expects($this->at(1))
126+
->method('find')
127+
->with(null, '/foo/bar/1')
128+
->will($this->returnValue(null));
129+
130+
$this->routeStack->expects($this->once())
131+
->method('replaceLastPathElement')
132+
->with('bar/2');
133+
134+
$this->routeMaker->expects($this->once())
135+
->method('make')
136+
->with($this->routeStack);
137+
138+
$aiPath = new AutoIncrementPath($this->dm, $this->routeMaker);
139+
$aiPath->init(array('format' => '/%d'));
140+
$aiPath->execute($this->routeStack);
141+
}
102142
}

0 commit comments

Comments
 (0)