-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
127 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,3 @@ phpcr_tests.db-journal | |
|
||
vendor/ | ||
composer.lock | ||
|
||
/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tests/Jackalope/Transport/DoctrineDBAL/DeleteCascadeTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Jackalope\Transport\DoctrineDBAL; | ||
|
||
use Doctrine\DBAL\Platforms\SqlitePlatform; | ||
use Jackalope\Test\FunctionalTestCase; | ||
use PHPCR\PropertyType; | ||
|
||
class DeleteCascadeTest extends FunctionalTestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$a = $this->session->getNode('/')->addNode('node-a'); | ||
$a->setProperty('data', 'foo', PropertyType::BINARY); | ||
$this->session->save(); | ||
} | ||
|
||
public function testRemoveProperty(): void | ||
{ | ||
$binaryRows = $this->conn->executeQuery('SELECT * FROM phpcr_binarydata'); | ||
$this->assertSame(1, $binaryRows->rowCount()); | ||
|
||
$this->session->removeItem('/node-a/data'); | ||
$this->session->save(); | ||
$binaryRows = $this->conn->executeQuery('SELECT * FROM phpcr_binarydata'); | ||
$this->assertSame(0, $binaryRows->rowCount()); | ||
} | ||
|
||
public function testRemovePropertyFromNode(): void | ||
{ | ||
$a = $this->session->getNode('/node-a'); | ||
$binaryRows = $this->conn->executeQuery('SELECT * FROM phpcr_binarydata'); | ||
$this->assertSame(1, $binaryRows->rowCount()); | ||
|
||
$a->getProperty('data')->remove(); | ||
$this->session->save(); | ||
$binaryRows = $this->conn->executeQuery('SELECT * FROM phpcr_binarydata'); | ||
$this->assertSame(0, $binaryRows->rowCount()); | ||
} | ||
|
||
public function testRemoveNode(): void | ||
{ | ||
if ($this->conn->getDatabasePlatform() instanceof SqlitePlatform) { | ||
$this->markTestSkipped('Foreign keys are not supported with sqlite'); | ||
} | ||
$a = $this->session->getNode('/node-a'); | ||
$binaryRows = $this->conn->executeQuery('SELECT * FROM phpcr_binarydata'); | ||
$this->assertSame(1, $binaryRows->rowCount()); | ||
|
||
$a->remove(); | ||
$this->session->save(); | ||
$binaryRows = $this->conn->executeQuery('SELECT * FROM phpcr_binarydata'); | ||
$this->assertSame(0, $binaryRows->rowCount()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters