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