| @@ 2653-2699 (lines=47) @@ | ||
| 2650 | /** |
|
| 2651 | * Test for the listGlobalAliases() method. |
|
| 2652 | */ |
|
| 2653 | public function testListGlobalAliases() |
|
| 2654 | { |
|
| 2655 | $urlAliasService = $this->getRepository()->getURLAliasService(); |
|
| 2656 | $configuration = array( |
|
| 2657 | 'prioritizedLanguageList' => array('ger-DE'), |
|
| 2658 | 'showAllTranslations' => true, |
|
| 2659 | ); |
|
| 2660 | $this->setConfiguration($urlAliasService, $configuration); |
|
| 2661 | $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler'); |
|
| 2662 | ||
| 2663 | $urlAliasHandler->expects( |
|
| 2664 | $this->once() |
|
| 2665 | )->method( |
|
| 2666 | 'listGlobalURLAliases' |
|
| 2667 | )->with( |
|
| 2668 | $this->equalTo(null), |
|
| 2669 | $this->equalTo(0), |
|
| 2670 | $this->equalTo(-1) |
|
| 2671 | )->will( |
|
| 2672 | $this->returnValue( |
|
| 2673 | array( |
|
| 2674 | new SPIUrlAlias( |
|
| 2675 | array( |
|
| 2676 | 'pathData' => array( |
|
| 2677 | array( |
|
| 2678 | 'always-available' => true, |
|
| 2679 | 'translations' => array( |
|
| 2680 | 'ger-DE' => 'squirrel', |
|
| 2681 | ), |
|
| 2682 | ), |
|
| 2683 | ), |
|
| 2684 | 'languageCodes' => array('ger-DE'), |
|
| 2685 | 'alwaysAvailable' => true, |
|
| 2686 | ) |
|
| 2687 | ), |
|
| 2688 | ) |
|
| 2689 | ) |
|
| 2690 | ); |
|
| 2691 | ||
| 2692 | $urlAliases = $urlAliasService->listGlobalAliases(); |
|
| 2693 | ||
| 2694 | self::assertCount(1, $urlAliases); |
|
| 2695 | self::assertInstanceOf( |
|
| 2696 | 'eZ\\Publish\\API\\Repository\\Values\\Content\\URLAlias', |
|
| 2697 | $urlAliases[0] |
|
| 2698 | ); |
|
| 2699 | } |
|
| 2700 | ||
| 2701 | /** |
|
| 2702 | * Test for the listGlobalAliases() method. |
|
| @@ 2704-2746 (lines=43) @@ | ||
| 2701 | /** |
|
| 2702 | * Test for the listGlobalAliases() method. |
|
| 2703 | */ |
|
| 2704 | public function testListGlobalAliasesEmpty() |
|
| 2705 | { |
|
| 2706 | $urlAliasService = $this->getRepository()->getURLAliasService(); |
|
| 2707 | $configuration = array( |
|
| 2708 | 'prioritizedLanguageList' => array('eng-GB'), |
|
| 2709 | 'showAllTranslations' => false, |
|
| 2710 | ); |
|
| 2711 | $this->setConfiguration($urlAliasService, $configuration); |
|
| 2712 | $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler'); |
|
| 2713 | ||
| 2714 | $urlAliasHandler->expects( |
|
| 2715 | $this->once() |
|
| 2716 | )->method( |
|
| 2717 | 'listGlobalURLAliases' |
|
| 2718 | )->with( |
|
| 2719 | $this->equalTo(null), |
|
| 2720 | $this->equalTo(0), |
|
| 2721 | $this->equalTo(-1) |
|
| 2722 | )->will( |
|
| 2723 | $this->returnValue( |
|
| 2724 | array( |
|
| 2725 | new SPIUrlAlias( |
|
| 2726 | array( |
|
| 2727 | 'pathData' => array( |
|
| 2728 | array( |
|
| 2729 | 'always-available' => false, |
|
| 2730 | 'translations' => array( |
|
| 2731 | 'ger-DE' => 'squirrel', |
|
| 2732 | ), |
|
| 2733 | ), |
|
| 2734 | ), |
|
| 2735 | 'languageCodes' => array('ger-DE'), |
|
| 2736 | 'alwaysAvailable' => false, |
|
| 2737 | ) |
|
| 2738 | ), |
|
| 2739 | ) |
|
| 2740 | ) |
|
| 2741 | ); |
|
| 2742 | ||
| 2743 | $urlAliases = $urlAliasService->listGlobalAliases(); |
|
| 2744 | ||
| 2745 | self::assertCount(0, $urlAliases); |
|
| 2746 | } |
|
| 2747 | ||
| 2748 | /** |
|
| 2749 | * Test for the listGlobalAliases() method. |
|