| @@ 29-51 (lines=23) @@ | ||
| 26 | * |
|
| 27 | * @covers \eZ\Publish\Core\Repository\Helper\NameSchemaService::resolveUrlAliasSchema |
|
| 28 | */ |
|
| 29 | public function testResolveUrlAliasSchema() |
|
| 30 | { |
|
| 31 | $serviceMock = $this->getPartlyMockedNameSchemaService(array('resolve')); |
|
| 32 | ||
| 33 | list($content, $contentType) = $this->buildTestObjects(); |
|
| 34 | ||
| 35 | $serviceMock->expects( |
|
| 36 | $this->once() |
|
| 37 | )->method( |
|
| 38 | 'resolve' |
|
| 39 | )->with( |
|
| 40 | '<urlalias_schema>', |
|
| 41 | $this->equalTo($contentType), |
|
| 42 | $this->equalTo($content->fields), |
|
| 43 | $this->equalTo($content->versionInfo->languageCodes) |
|
| 44 | )->will( |
|
| 45 | $this->returnValue(42) |
|
| 46 | ); |
|
| 47 | ||
| 48 | $result = $serviceMock->resolveUrlAliasSchema($content, $contentType); |
|
| 49 | ||
| 50 | self::assertEquals(42, $result); |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Test eZ\Publish\Core\Repository\Helper\NameSchemaService method. |
|
| @@ 58-80 (lines=23) @@ | ||
| 55 | * |
|
| 56 | * @covers \eZ\Publish\Core\Repository\Helper\NameSchemaService::resolveUrlAliasSchema |
|
| 57 | */ |
|
| 58 | public function testResolveUrlAliasSchemaFallbackToNameSchema() |
|
| 59 | { |
|
| 60 | $serviceMock = $this->getPartlyMockedNameSchemaService(array('resolve')); |
|
| 61 | ||
| 62 | list($content, $contentType) = $this->buildTestObjects('<name_schema>', ''); |
|
| 63 | ||
| 64 | $serviceMock->expects( |
|
| 65 | $this->once() |
|
| 66 | )->method( |
|
| 67 | 'resolve' |
|
| 68 | )->with( |
|
| 69 | '<name_schema>', |
|
| 70 | $this->equalTo($contentType), |
|
| 71 | $this->equalTo($content->fields), |
|
| 72 | $this->equalTo($content->versionInfo->languageCodes) |
|
| 73 | )->will( |
|
| 74 | $this->returnValue(42) |
|
| 75 | ); |
|
| 76 | ||
| 77 | $result = $serviceMock->resolveUrlAliasSchema($content, $contentType); |
|
| 78 | ||
| 79 | self::assertEquals(42, $result); |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Test eZ\Publish\Core\Repository\Helper\NameSchemaService method. |
|
| @@ 87-109 (lines=23) @@ | ||
| 84 | * |
|
| 85 | * @covers \eZ\Publish\Core\Repository\Helper\NameSchemaService::resolveNameSchema |
|
| 86 | */ |
|
| 87 | public function testResolveNameSchema() |
|
| 88 | { |
|
| 89 | $serviceMock = $this->getPartlyMockedNameSchemaService(array('resolve')); |
|
| 90 | ||
| 91 | list($content, $contentType) = $this->buildTestObjects(); |
|
| 92 | ||
| 93 | $serviceMock->expects( |
|
| 94 | $this->once() |
|
| 95 | )->method( |
|
| 96 | 'resolve' |
|
| 97 | )->with( |
|
| 98 | '<name_schema>', |
|
| 99 | $this->equalTo($contentType), |
|
| 100 | $this->equalTo($content->fields), |
|
| 101 | $this->equalTo($content->versionInfo->languageCodes) |
|
| 102 | )->will( |
|
| 103 | $this->returnValue(42) |
|
| 104 | ); |
|
| 105 | ||
| 106 | $result = $serviceMock->resolveNameSchema($content, array(), array(), $contentType); |
|
| 107 | ||
| 108 | self::assertEquals(42, $result); |
|
| 109 | } |
|
| 110 | ||
| 111 | /** |
|
| 112 | * Test eZ\Publish\Core\Repository\Helper\NameSchemaService method. |
|