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