| @@ 932-960 (lines=29) @@ | ||
| 929 | /** |
|
| 930 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteRelations |
|
| 931 | */ |
|
| 932 | public function testDeleteRelationsTo() |
|
| 933 | { |
|
| 934 | $this->insertDatabaseFixture( |
|
| 935 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 936 | ); |
|
| 937 | ||
| 938 | $beforeCount = [ |
|
| 939 | 'all' => $this->countContentRelations(), |
|
| 940 | 'from' => $this->countContentRelations(149), |
|
| 941 | 'to' => $this->countContentRelations(null, 149), |
|
| 942 | ]; |
|
| 943 | ||
| 944 | $gateway = $this->getDatabaseGateway(); |
|
| 945 | $gateway->deleteRelations(149); |
|
| 946 | ||
| 947 | $this->assertEquals( |
|
| 948 | // yes, relates to itself! |
|
| 949 | [ |
|
| 950 | 'all' => $beforeCount['all'] - 2, |
|
| 951 | 'from' => $beforeCount['from'] - 1, |
|
| 952 | 'to' => $beforeCount['to'] - 2, |
|
| 953 | ], |
|
| 954 | [ |
|
| 955 | 'all' => $this->countContentRelations(), |
|
| 956 | 'from' => $this->countContentRelations(149), |
|
| 957 | 'to' => $this->countContentRelations(null, 149), |
|
| 958 | ] |
|
| 959 | ); |
|
| 960 | } |
|
| 961 | ||
| 962 | /** |
|
| 963 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteRelations |
|
| @@ 965-992 (lines=28) @@ | ||
| 962 | /** |
|
| 963 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteRelations |
|
| 964 | */ |
|
| 965 | public function testDeleteRelationsFrom() |
|
| 966 | { |
|
| 967 | $this->insertDatabaseFixture( |
|
| 968 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 969 | ); |
|
| 970 | ||
| 971 | $beforeCount = [ |
|
| 972 | 'all' => $this->countContentRelations(), |
|
| 973 | 'from' => $this->countContentRelations(75), |
|
| 974 | 'to' => $this->countContentRelations(null, 75), |
|
| 975 | ]; |
|
| 976 | ||
| 977 | $gateway = $this->getDatabaseGateway(); |
|
| 978 | $gateway->deleteRelations(75); |
|
| 979 | ||
| 980 | $this->assertEquals( |
|
| 981 | [ |
|
| 982 | 'all' => $beforeCount['all'] - 6, |
|
| 983 | 'from' => $beforeCount['from'] - 6, |
|
| 984 | 'to' => $beforeCount['to'], |
|
| 985 | ], |
|
| 986 | [ |
|
| 987 | 'all' => $this->countContentRelations(), |
|
| 988 | 'from' => $this->countContentRelations(75), |
|
| 989 | 'to' => $this->countContentRelations(null, 75), |
|
| 990 | ] |
|
| 991 | ); |
|
| 992 | } |
|
| 993 | ||
| 994 | /** |
|
| 995 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteRelations |
|
| @@ 997-1024 (lines=28) @@ | ||
| 994 | /** |
|
| 995 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteRelations |
|
| 996 | */ |
|
| 997 | public function testDeleteRelationsWithSecondArgument() |
|
| 998 | { |
|
| 999 | $this->insertDatabaseFixture( |
|
| 1000 | __DIR__ . '/../_fixtures/contentobjects.php' |
|
| 1001 | ); |
|
| 1002 | ||
| 1003 | $beforeCount = [ |
|
| 1004 | 'all' => $this->countContentRelations(), |
|
| 1005 | 'from' => $this->countContentRelations(225), |
|
| 1006 | 'to' => $this->countContentRelations(null, 225), |
|
| 1007 | ]; |
|
| 1008 | ||
| 1009 | $gateway = $this->getDatabaseGateway(); |
|
| 1010 | $gateway->deleteRelations(225, 2); |
|
| 1011 | ||
| 1012 | $this->assertEquals( |
|
| 1013 | [ |
|
| 1014 | 'all' => $beforeCount['all'] - 1, |
|
| 1015 | 'from' => $beforeCount['from'] - 1, |
|
| 1016 | 'to' => $beforeCount['to'], |
|
| 1017 | ], |
|
| 1018 | [ |
|
| 1019 | 'all' => $this->countContentRelations(), |
|
| 1020 | 'from' => $this->countContentRelations(225), |
|
| 1021 | 'to' => $this->countContentRelations(null, 225), |
|
| 1022 | ] |
|
| 1023 | ); |
|
| 1024 | } |
|
| 1025 | ||
| 1026 | /** |
|
| 1027 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::deleteField |
|