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