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