| @@ 59-72 (lines=14) @@ | ||
| 56 | * @param $entity |
|
| 57 | * @param $expected |
|
| 58 | */ |
|
| 59 | public function testGetName($format, $locale, $entity, $expected) |
|
| 60 | { |
|
| 61 | if ($expected) { |
|
| 62 | $this->contactNameFormatter->expects($this->once())->method('format') |
|
| 63 | ->willReturn('Contact'); |
|
| 64 | ||
| 65 | $this->nameFormatterLink->expects($this->once()) |
|
| 66 | ->method('getService') |
|
| 67 | ->willReturn($this->contactNameFormatter); |
|
| 68 | } |
|
| 69 | ||
| 70 | $result = $this->provider->getName($format, $locale, $entity); |
|
| 71 | $this->assertEquals($expected, $result); |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * @dataProvider getNameDQLDataProvider |
|
| @@ 83-96 (lines=14) @@ | ||
| 80 | * @param $alias |
|
| 81 | * @param $expected |
|
| 82 | */ |
|
| 83 | public function testGetNameDQL($format, $locale, $className, $alias, $expected) |
|
| 84 | { |
|
| 85 | if ($expected) { |
|
| 86 | $this->dqlNameFormatter->expects($this->once())->method('getFormattedNameDQL') |
|
| 87 | ->willReturn('Contact'); |
|
| 88 | ||
| 89 | $this->dqlNameFormatterLink->expects($this->once()) |
|
| 90 | ->method('getService') |
|
| 91 | ->willReturn($this->dqlNameFormatter); |
|
| 92 | } |
|
| 93 | ||
| 94 | $result = $this->provider->getNameDQL($format, $locale, $className, $alias); |
|
| 95 | $this->assertEquals($expected, $result); |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * @return array |
|