| 78 | | foreach(range(1, 10) as $loop) |
|---|
| 79 | | { |
|---|
| 80 | | $info = $routingNew->parse('/symfony/rules/420'); |
|---|
| 81 | | $t->is($info['_sf_route']->getPattern(), '/symfony/rules/420'); |
|---|
| 82 | | $info = $routingNew->parse('/symfony345/foo/bar'); |
|---|
| 83 | | $t->is($info['_sf_route'], null); |
|---|
| 84 | | $info = $routingNew->parse('/symfony345/1234/foo'); |
|---|
| 85 | | $t->is($info['_sf_route']->getPattern(), '/symfony345/:build/:file'); |
|---|
| 86 | | $info = $routingNew->parse('/star/foo/1/bar/2'); |
|---|
| 87 | | $t->is($info['foo'], '1'); |
|---|
| 88 | | $t->is($info['bar'], '2'); |
|---|
| | 82 | foreach(range(1, $cycles) as $cycle) |
|---|
| | 83 | { |
|---|
| | 84 | foreach(range(1, 20) as $loop) |
|---|
| | 85 | { |
|---|
| | 86 | $info = $routingNew->parse(sprintf('/symfony/rules/4%02s', $loop)); |
|---|
| | 87 | $t->is($info['_sf_route']->getPattern(), sprintf('/symfony/rules/4%02s', $loop)); |
|---|
| | 88 | |
|---|
| | 89 | $info = $routingNew->parse('/symfony345/foo/bar'); |
|---|
| | 90 | $t->is($info['_sf_route'], null); |
|---|
| | 91 | |
|---|
| | 92 | $info = $routingNew->parse('/symfony345/1234/foo'); |
|---|
| | 93 | $t->is($info['_sf_route']->getPattern(), '/symfony345/:build/:file'); |
|---|
| | 94 | // same url again to benefit potentially from caching |
|---|
| | 95 | $info = $routingNew->parse('/symfony345/1234/foo'); |
|---|
| | 96 | $t->is($info['_sf_route']->getPattern(), '/symfony345/:build/:file'); |
|---|
| | 97 | |
|---|
| | 98 | $info = $routingNew->parse(sprintf('/star/foo/%s/bar/2', $loop)); |
|---|
| | 99 | $t->is($info['foo'], $loop); |
|---|
| | 100 | $t->is($info['bar'], '2'); |
|---|
| | 101 | |
|---|
| | 102 | $url = $routingNew->generate(sprintf('moduleA3%02s', $loop), array('build' => 42, 'file' => 'foo')); |
|---|
| | 103 | $t->is($url, sprintf('/symfony3%02s/42/foo', $loop)); |
|---|
| | 104 | // same url again to benefit potentially from caching |
|---|
| | 105 | $url = $routingNew->generate(sprintf('moduleA3%02s', $loop), array('build' => 42, 'file' => 'foo')); |
|---|
| | 106 | $t->is($url, sprintf('/symfony3%02s/42/foo', $loop)); |
|---|
| | 107 | |
|---|
| | 108 | $url = $routingNew->generate(null , array('foo' => 'cat', 'bar' => $loop, 'module' => 'moduleC')); |
|---|
| | 109 | $t->is($url, sprintf('/symfony/rocks/1/cat/%s', $loop)); |
|---|
| | 110 | } |
|---|
| 90 | | $t->diag($patch.' Routing - Generating Routes 20 times'); |
|---|
| 91 | | foreach(range(1, 20) as $loop) |
|---|
| 92 | | { |
|---|
| 93 | | $url = $routingNew->generate('moduleA333', array('build' => 42, 'file' => 'foo')); |
|---|
| 94 | | $t->is($url, '/symfony333/42/foo'); |
|---|
| 95 | | $url = $routingNew->generate(null , array('foo' => 'cat', 'bar' => 'dog', 'module' => 'moduleC')); |
|---|
| 96 | | $t->is($url, '/symfony/rocks/1/cat/dog'); |
|---|
| 97 | | } |
|---|
| 98 | | |
|---|