| @@ 1557-1608 (lines=52) @@ | ||
| 1554 | * |
|
| 1555 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::updateAlwaysAvailableFlag |
|
| 1556 | */ |
|
| 1557 | public function testUpdateAlwaysAvailableFlagRemove() |
|
| 1558 | { |
|
| 1559 | $this->insertDatabaseFixture( |
|
| 1560 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 1561 | ); |
|
| 1562 | ||
| 1563 | $gateway = $this->getDatabaseGateway(); |
|
| 1564 | $gateway->updateAlwaysAvailableFlag(103, false); |
|
| 1565 | ||
| 1566 | $this->assertQueryResult( |
|
| 1567 | array(array('id' => 2)), |
|
| 1568 | $this->getDatabaseHandler()->createSelectQuery()->select( |
|
| 1569 | array('language_mask') |
|
| 1570 | )->from( |
|
| 1571 | 'ezcontentobject' |
|
| 1572 | )->where( |
|
| 1573 | 'id = 103' |
|
| 1574 | ) |
|
| 1575 | ); |
|
| 1576 | ||
| 1577 | $query = $this->getDatabaseHandler()->createSelectQuery(); |
|
| 1578 | $this->assertQueryResult( |
|
| 1579 | array(array('language_id' => 2)), |
|
| 1580 | $query->select( |
|
| 1581 | array('language_id') |
|
| 1582 | )->from( |
|
| 1583 | 'ezcontentobject_name' |
|
| 1584 | )->where( |
|
| 1585 | $query->expr->lAnd( |
|
| 1586 | $query->expr->eq('contentobject_id', 103), |
|
| 1587 | $query->expr->eq('content_version', 1) |
|
| 1588 | ) |
|
| 1589 | ) |
|
| 1590 | ); |
|
| 1591 | ||
| 1592 | $query = $this->getDatabaseHandler()->createSelectQuery(); |
|
| 1593 | $this->assertQueryResult( |
|
| 1594 | array( |
|
| 1595 | array('language_id' => 2), |
|
| 1596 | ), |
|
| 1597 | $query->selectDistinct( |
|
| 1598 | array('language_id') |
|
| 1599 | )->from( |
|
| 1600 | 'ezcontentobject_attribute' |
|
| 1601 | )->where( |
|
| 1602 | $query->expr->lAnd( |
|
| 1603 | $query->expr->eq('contentobject_id', 103), |
|
| 1604 | $query->expr->eq('version', 1) |
|
| 1605 | ) |
|
| 1606 | ) |
|
| 1607 | ); |
|
| 1608 | } |
|
| 1609 | ||
| 1610 | /** |
|
| 1611 | * Test for the updateAlwaysAvailableFlag() method. |
|
| @@ 1615-1666 (lines=52) @@ | ||
| 1612 | * |
|
| 1613 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::updateAlwaysAvailableFlag |
|
| 1614 | */ |
|
| 1615 | public function testUpdateAlwaysAvailableFlagAdd() |
|
| 1616 | { |
|
| 1617 | $this->insertDatabaseFixture( |
|
| 1618 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 1619 | ); |
|
| 1620 | ||
| 1621 | $gateway = $this->getDatabaseGateway(); |
|
| 1622 | $gateway->updateAlwaysAvailableFlag(102, true); |
|
| 1623 | ||
| 1624 | $this->assertQueryResult( |
|
| 1625 | array(array('id' => 3)), |
|
| 1626 | $this->getDatabaseHandler()->createSelectQuery()->select( |
|
| 1627 | array('language_mask') |
|
| 1628 | )->from( |
|
| 1629 | 'ezcontentobject' |
|
| 1630 | )->where( |
|
| 1631 | 'id = 102' |
|
| 1632 | ) |
|
| 1633 | ); |
|
| 1634 | ||
| 1635 | $query = $this->getDatabaseHandler()->createSelectQuery(); |
|
| 1636 | $this->assertQueryResult( |
|
| 1637 | array(array('language_id' => 3)), |
|
| 1638 | $query->select( |
|
| 1639 | array('language_id') |
|
| 1640 | )->from( |
|
| 1641 | 'ezcontentobject_name' |
|
| 1642 | )->where( |
|
| 1643 | $query->expr->lAnd( |
|
| 1644 | $query->expr->eq('contentobject_id', 102), |
|
| 1645 | $query->expr->eq('content_version', 1) |
|
| 1646 | ) |
|
| 1647 | ) |
|
| 1648 | ); |
|
| 1649 | ||
| 1650 | $query = $this->getDatabaseHandler()->createSelectQuery(); |
|
| 1651 | $this->assertQueryResult( |
|
| 1652 | array( |
|
| 1653 | array('language_id' => 3), |
|
| 1654 | ), |
|
| 1655 | $query->selectDistinct( |
|
| 1656 | array('language_id') |
|
| 1657 | )->from( |
|
| 1658 | 'ezcontentobject_attribute' |
|
| 1659 | )->where( |
|
| 1660 | $query->expr->lAnd( |
|
| 1661 | $query->expr->eq('contentobject_id', 102), |
|
| 1662 | $query->expr->eq('version', 1) |
|
| 1663 | ) |
|
| 1664 | ) |
|
| 1665 | ); |
|
| 1666 | } |
|
| 1667 | ||
| 1668 | /** |
|
| 1669 | * Test for the updateAlwaysAvailableFlag() method. |
|