-
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.
Merge pull request #256 from jackalope/fix-namespaces-cached-client
Handle the ArrayObject in CachedClient as well
- Loading branch information
Showing
3 changed files
with
73 additions
and
5 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
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
66 changes: 66 additions & 0 deletions
66
tests/Jackalope/Transport/DoctrineDBAL/CachedClientTest.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,66 @@ | ||
<?php | ||
|
||
namespace Jackalope\Transport\DoctrineDBAL; | ||
|
||
use Doctrine\DBAL\Platforms\SqlitePlatform; | ||
use Jackalope\Repository; | ||
use Jackalope\Session; | ||
use Jackalope\Test\TestCase; | ||
use PHPCR\PropertyType; | ||
use PHPCR\Util\NodeHelper; | ||
use PHPCR\Util\PathHelper; | ||
|
||
class CachedClientTest extends TestCase | ||
{ | ||
/** | ||
* @var Client | ||
*/ | ||
private $transport; | ||
|
||
/** | ||
* @var Repository | ||
*/ | ||
private $repository; | ||
|
||
/** | ||
* @var Session | ||
*/ | ||
private $session; | ||
|
||
public function setUp() | ||
{ | ||
static $initialized = false; | ||
parent::setUp(); | ||
|
||
$conn = $this->getConnection(); | ||
$options = array('disable_fks' => $conn->getDatabasePlatform() instanceof SqlitePlatform); | ||
$schema = new RepositorySchema($options, $conn); | ||
$tables = $schema->getTables(); | ||
|
||
foreach ($tables as $table) { | ||
$conn->exec('DELETE FROM ' . $table->getName()); | ||
} | ||
|
||
$this->transport = new \Jackalope\Transport\DoctrineDBAL\CachedClient(new \Jackalope\Factory(), $conn); | ||
$this->transport->createWorkspace('default'); | ||
|
||
$this->repository = new \Jackalope\Repository(null, $this->transport); | ||
|
||
try { | ||
$this->transport->createWorkspace($GLOBALS['phpcr.workspace']); | ||
} catch (\PHPCR\RepositoryException $e) { | ||
if ($e->getMessage() != "Workspace '".$GLOBALS['phpcr.workspace']."' already exists") { | ||
// if the message is not that the workspace already exists, something went really wrong | ||
throw $e; | ||
} | ||
} | ||
$this->session = $this->repository->login(new \PHPCR\SimpleCredentials("user", "passwd"), $GLOBALS['phpcr.workspace']); | ||
} | ||
|
||
public function testArrayObjectIsConvertedToArray() | ||
{ | ||
$namespaces = $this->transport->getNamespaces(); | ||
|
||
$this->assertInternalType("array", $namespaces); | ||
} | ||
} |