| @@ 1658-1719 (lines=62) @@ | ||
| 1655 | * |
|
| 1656 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::updateAlwaysAvailableFlag |
|
| 1657 | */ |
|
| 1658 | public function testUpdateContentAddAlwaysAvailableFlagMultilingual() |
|
| 1659 | { |
|
| 1660 | $this->insertDatabaseFixture( |
|
| 1661 | __DIR__ . '/../_fixtures/contentobjects_multilingual.php' |
|
| 1662 | ); |
|
| 1663 | ||
| 1664 | $gateway = $this->getDatabaseGateway(); |
|
| 1665 | $contentMetadataUpdateStruct = new MetadataUpdateStruct( |
|
| 1666 | [ |
|
| 1667 | 'mainLanguageId' => 4, |
|
| 1668 | 'alwaysAvailable' => true, |
|
| 1669 | ] |
|
| 1670 | ); |
|
| 1671 | $gateway->updateContent(4, $contentMetadataUpdateStruct); |
|
| 1672 | ||
| 1673 | $this->assertQueryResult( |
|
| 1674 | [['id' => 7]], |
|
| 1675 | $this->getDatabaseHandler()->createSelectQuery()->select( |
|
| 1676 | ['language_mask'] |
|
| 1677 | )->from( |
|
| 1678 | 'ezcontentobject' |
|
| 1679 | )->where( |
|
| 1680 | 'id = 4' |
|
| 1681 | ) |
|
| 1682 | ); |
|
| 1683 | ||
| 1684 | $query = $this->getDatabaseHandler()->createSelectQuery(); |
|
| 1685 | $this->assertQueryResult( |
|
| 1686 | [ |
|
| 1687 | ['id' => '7', 'language_id' => 2], |
|
| 1688 | ['id' => '8', 'language_id' => 5], |
|
| 1689 | ], |
|
| 1690 | $query->selectDistinct( |
|
| 1691 | ['id', 'language_id'] |
|
| 1692 | )->from( |
|
| 1693 | 'ezcontentobject_attribute' |
|
| 1694 | )->where( |
|
| 1695 | $query->expr->lAnd( |
|
| 1696 | $query->expr->eq('contentobject_id', 4), |
|
| 1697 | $query->expr->eq('version', 2) |
|
| 1698 | ) |
|
| 1699 | )->orderBy('id') |
|
| 1700 | ); |
|
| 1701 | ||
| 1702 | $query = $this->getDatabaseHandler()->createSelectQuery(); |
|
| 1703 | $this->assertQueryResult( |
|
| 1704 | [ |
|
| 1705 | ['id' => '7', 'language_id' => 2], |
|
| 1706 | ['id' => '8', 'language_id' => 5], |
|
| 1707 | ], |
|
| 1708 | $query->selectDistinct( |
|
| 1709 | ['id', 'language_id'] |
|
| 1710 | )->from( |
|
| 1711 | 'ezcontentobject_attribute' |
|
| 1712 | )->where( |
|
| 1713 | $query->expr->lAnd( |
|
| 1714 | $query->expr->eq('contentobject_id', 4), |
|
| 1715 | $query->expr->eq('version', 1) |
|
| 1716 | ) |
|
| 1717 | )->orderBy('id') |
|
| 1718 | ); |
|
| 1719 | } |
|
| 1720 | ||
| 1721 | /** |
|
| 1722 | * Test for the updateAlwaysAvailableFlag() method. |
|
| @@ 1726-1787 (lines=62) @@ | ||
| 1723 | * |
|
| 1724 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::updateAlwaysAvailableFlag |
|
| 1725 | */ |
|
| 1726 | public function testUpdateContentRemoveAlwaysAvailableFlagMultilingual() |
|
| 1727 | { |
|
| 1728 | $this->insertDatabaseFixture( |
|
| 1729 | __DIR__ . '/../_fixtures/contentobjects_multilingual.php' |
|
| 1730 | ); |
|
| 1731 | ||
| 1732 | $gateway = $this->getDatabaseGateway(); |
|
| 1733 | $contentMetadataUpdateStruct = new MetadataUpdateStruct( |
|
| 1734 | [ |
|
| 1735 | 'mainLanguageId' => 4, |
|
| 1736 | 'alwaysAvailable' => false, |
|
| 1737 | ] |
|
| 1738 | ); |
|
| 1739 | $gateway->updateContent(4, $contentMetadataUpdateStruct); |
|
| 1740 | ||
| 1741 | $this->assertQueryResult( |
|
| 1742 | [['id' => 6]], |
|
| 1743 | $this->getDatabaseHandler()->createSelectQuery()->select( |
|
| 1744 | ['language_mask'] |
|
| 1745 | )->from( |
|
| 1746 | 'ezcontentobject' |
|
| 1747 | )->where( |
|
| 1748 | 'id = 4' |
|
| 1749 | ) |
|
| 1750 | ); |
|
| 1751 | ||
| 1752 | $query = $this->getDatabaseHandler()->createSelectQuery(); |
|
| 1753 | $this->assertQueryResult( |
|
| 1754 | [ |
|
| 1755 | ['id' => '7', 'language_id' => 2], |
|
| 1756 | ['id' => '8', 'language_id' => 4], |
|
| 1757 | ], |
|
| 1758 | $query->selectDistinct( |
|
| 1759 | ['id', 'language_id'] |
|
| 1760 | )->from( |
|
| 1761 | 'ezcontentobject_attribute' |
|
| 1762 | )->where( |
|
| 1763 | $query->expr->lAnd( |
|
| 1764 | $query->expr->eq('contentobject_id', 4), |
|
| 1765 | $query->expr->eq('version', 2) |
|
| 1766 | ) |
|
| 1767 | )->orderBy('id') |
|
| 1768 | ); |
|
| 1769 | ||
| 1770 | $query = $this->getDatabaseHandler()->createSelectQuery(); |
|
| 1771 | $this->assertQueryResult( |
|
| 1772 | [ |
|
| 1773 | ['id' => '7', 'language_id' => 2], |
|
| 1774 | ['id' => '8', 'language_id' => 5], |
|
| 1775 | ], |
|
| 1776 | $query->selectDistinct( |
|
| 1777 | ['id', 'language_id'] |
|
| 1778 | )->from( |
|
| 1779 | 'ezcontentobject_attribute' |
|
| 1780 | )->where( |
|
| 1781 | $query->expr->lAnd( |
|
| 1782 | $query->expr->eq('contentobject_id', 4), |
|
| 1783 | $query->expr->eq('version', 1) |
|
| 1784 | ) |
|
| 1785 | )->orderBy('id') |
|
| 1786 | ); |
|
| 1787 | } |
|
| 1788 | ||
| 1789 | public function testLoadVersionInfo() |
|
| 1790 | { |
|