| @@ 29-39 (lines=11) @@ | ||
| 26 | $this->assertSame(['templated' => false], $link->getAttributes()); |
|
| 27 | } |
|
| 28 | ||
| 29 | public function testRoute() |
|
| 30 | { |
|
| 31 | $link = $this->createLinkFactory()->createLink( |
|
| 32 | new TestedObject(), |
|
| 33 | new Relation('foo', new Route('/route', array('foo' => 'bar'))) |
|
| 34 | ); |
|
| 35 | ||
| 36 | $this->assertInstanceOf('Hateoas\Model\Link', $link); |
|
| 37 | $this->assertSame('foo', $link->getRel()); |
|
| 38 | $this->assertSame('/route?foo=bar', $link->getHref()); |
|
| 39 | } |
|
| 40 | ||
| 41 | public function testExpressions() |
|
| 42 | { |
|
| @@ 66-84 (lines=19) @@ | ||
| 63 | $this->assertSame('/route?a=b', $link->getHref()); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function testParametersDeepArrayExpression() |
|
| 67 | { |
|
| 68 | $link = $this->createLinkFactory()->createLink( |
|
| 69 | new TestedObject(), |
|
| 70 | new Relation( |
|
| 71 | 'foo', |
|
| 72 | new Route( |
|
| 73 | '/route', |
|
| 74 | array( |
|
| 75 | 'expr(object.getRel())' => array('expr(object.getRel())') |
|
| 76 | ) |
|
| 77 | ) |
|
| 78 | ) |
|
| 79 | ); |
|
| 80 | ||
| 81 | $this->assertInstanceOf('Hateoas\Model\Link', $link); |
|
| 82 | $this->assertSame('foo', $link->getRel()); |
|
| 83 | $this->assertSame('/route?tested-rel%5B0%5D=tested-rel', $link->getHref()); |
|
| 84 | } |
|
| 85 | ||
| 86 | public function testRouteRequiresGenerator() |
|
| 87 | { |
|