Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

naming alignments, AS to as in foreach, dirname(__FILE__) => __DIR__

  • Loading branch information...
commit 3b26bec83045fdba5d3c2159ffce567d12271f89 1 parent 0970226
@lsmith77 lsmith77 authored
View
15 .gitignore
@@ -7,11 +7,12 @@ cscope.out
doc/config/phpdoc.ini
doc/html
-/tests/phpunit_jackrabbit.xml
-/tests/phpunit_doctrinedbal.xml
-/tests/fixtures/doctrine
-/tests/phpunit.xml
+tests/phpunit_jackrabbit.xml
+tests/phpunit_doctrine_dbal.xml
+tests/fixtures/doctrine
+tests/phpunit.xml
-
-jackrabbit/
-jackrabbit-standalone*.jar
+tests/vendor/doctrine-dbal
+tests/vendor/doctrine-common
+tests/vendor/jackrabbit-standalone*.jar
+tests/vendor/jackrabbit
View
2  README.DOCTRINE.md
@@ -29,7 +29,7 @@ You need both Jackalope with the DoctrineDBAL branch and Doctrine Common+DBAL in
// only necessary on the first run, creates the database:
$schema = \Jackalope\Transport\DoctrineDBAL\RepositorySchema::create();
- foreach ($schema->toSQL($dbConn->getDatabasePlatform()) AS $sql) {
+ foreach ($schema->toSQL($dbConn->getDatabasePlatform()) as $sql) {
$dbConn->exec($sql);
}
View
4 src/Jackalope/NodeType/NodeTypeDefinition.php
@@ -122,14 +122,14 @@ protected function fromArray(array $data)
$this->primaryItemName = $data['primaryItemName'] ?: null;
$this->declaredSuperTypeNames = (isset($data['declaredSuperTypeNames']) && count($data['declaredSuperTypeNames'])) ? $data['declaredSuperTypeNames'] : array();
$this->declaredPropertyDefinitions = new ArrayObject();
- foreach ($data['declaredPropertyDefinitions'] AS $propertyDef) {
+ foreach ($data['declaredPropertyDefinitions'] as $propertyDef) {
$this->declaredPropertyDefinitions[] = $this->factory->get(
'NodeType\PropertyDefinition',
array($propertyDef, $this->nodeTypeManager)
);
}
$this->declaredNodeDefinitions = new ArrayObject();
- foreach ($data['declaredNodeDefinitions'] AS $nodeDef) {
+ foreach ($data['declaredNodeDefinitions'] as $nodeDef) {
$this->declaredNodeDefinitions[] = $this->factory->get(
'NodeType\NodeDefinition',
array($nodeDef, $this->nodeTypeManager)
View
56 src/Jackalope/Transport/DoctrineDBAL/Client.php
@@ -280,7 +280,7 @@ public function getNamespaces()
$data = $this->conn->fetchAll('SELECT * FROM phpcr_namespaces');
$this->fetchedUserNamespaces = true;
- foreach ($data AS $row) {
+ foreach ($data as $row) {
$this->namespaces[$row['prefix']] = $row['uri'];
}
}
@@ -438,8 +438,8 @@ private function syncUserIndexes()
private function syncBinaryData($nodeId, $binaryData)
{
- foreach ($binaryData AS $propertyName => $binaryValues) {
- foreach ($binaryValues AS $idx => $data) {
+ foreach ($binaryData as $propertyName => $binaryValues) {
+ foreach ($binaryValues as $idx => $data) {
$this->conn->delete('phpcr_binarydata', array(
'node_id' => $nodeId,
'property_name' => $propertyName,
@@ -461,12 +461,12 @@ private function syncForeignKeys($nodeId, $path, $props)
$this->conn->delete('phpcr_nodes_foreignkeys', array(
'source_id' => $nodeId,
));
- foreach ($props AS $property) {
+ foreach ($props as $property) {
$type = $property->getType();
if ($type == \PHPCR\PropertyType::REFERENCE || $type == \PHPCR\PropertyType::WEAKREFERENCE) {
$values = array_unique( $property->isMultiple() ? $property->getString() : array($property->getString()) );
- foreach ($values AS $value) {
+ foreach ($values as $value) {
$targetId = $this->pathExists($this->getNodePathForIdentifier($value));
if (!$targetId) {
if ($type == \PHPCR\PropertyType::REFERENCE) {
@@ -515,7 +515,7 @@ static public function propsToXML($properties, $inlineBinaries = false)
$dom->appendChild($rootNode);
$binaryData = null;
- foreach ($properties AS $property) {
+ foreach ($properties as $property) {
/* @var $prop \PHPCR\PropertyInterface */
$propertyNode = $dom->createElement('sv:property');
$propertyNode->setAttribute('sv:name', $property->getName());
@@ -542,7 +542,7 @@ static public function propsToXML($properties, $inlineBinaries = false)
break;
case \PHPCR\PropertyType::BINARY:
if ($property->isMultiple()) {
- foreach ((array)$property->getBinary() AS $binary) {
+ foreach ((array)$property->getBinary() as $binary) {
$binary = stream_get_contents($binary);
$binaryData[$property->getName()][] = $binary;
$values[] = strlen($binary);
@@ -562,7 +562,7 @@ static public function propsToXML($properties, $inlineBinaries = false)
break;
}
- foreach ((array)$values AS $value) {
+ foreach ((array)$values as $value) {
$propertyNode->appendChild($dom->createElement('sv:value', $value));
}
@@ -576,7 +576,7 @@ static public function propsToXML($properties, $inlineBinaries = false)
public function getAccessibleWorkspaceNames()
{
$workspaceNames = array();
- foreach ($this->conn->fetchAll("SELECT name FROM phpcr_workspaces") AS $row) {
+ foreach ($this->conn->fetchAll("SELECT name FROM phpcr_workspaces") as $row) {
$workspaceNames[] = $row['name'];
}
return $workspaceNames;
@@ -602,7 +602,7 @@ public function getNode($path)
$sql = "SELECT path FROM phpcr_nodes WHERE parent = ? AND workspace_id = ?";
$children = $this->conn->fetchAll($sql, array($path, $this->workspaceId));
- foreach ($children AS $child) {
+ foreach ($children as $child) {
$childName = explode("/", $child['path']);
$childName = end($childName);
$data->{$childName} = new \stdClass();
@@ -611,11 +611,11 @@ public function getNode($path)
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->loadXML($row['props']);
- foreach ($dom->getElementsByTagNameNS('http://www.jcp.org/jcr/sv/1.0', 'property') AS $propertyNode) {
+ foreach ($dom->getElementsByTagNameNS('http://www.jcp.org/jcr/sv/1.0', 'property') as $propertyNode) {
$name = $propertyNode->getAttribute('sv:name');
$values = array();
$type = (int)$propertyNode->getAttribute('sv:type');
- foreach ($propertyNode->childNodes AS $valueNode) {
+ foreach ($propertyNode->childNodes as $valueNode) {
switch ($type) {
case \PHPCR\PropertyType::NAME:
case \PHPCR\PropertyType::URI:
@@ -736,7 +736,7 @@ public function deleteNode($path)
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->loadXml($xml);
- foreach ($dom->getElementsByTagNameNS('http://www.jcp.org/jcr/sv/1.0', 'property') AS $propertyNode) {
+ foreach ($dom->getElementsByTagNameNS('http://www.jcp.org/jcr/sv/1.0', 'property') as $propertyNode) {
if ($propertyName == $propertyNode->getAttribute('sv:name')) {
$propertyNode->parentNode->removeChild($propertyNode);
break;
@@ -808,7 +808,7 @@ private function getParentPath($path)
*/
private function validateNode($node, $def)
{
- foreach ($def->getDeclaredChildNodeDefinitions() AS $childDef) {
+ foreach ($def->getDeclaredChildNodeDefinitions() as $childDef) {
/* @var $childDef \PHPCR\NodeType\NodeDefinitionInterface */
if (!$node->hasNode($childDef->getName())) {
if ($childDef->getName() === '*') {
@@ -834,7 +834,7 @@ private function validateNode($node, $def)
}
}
- foreach ($def->getDeclaredPropertyDefinitions() AS $propertyDef) {
+ foreach ($def->getDeclaredPropertyDefinitions() as $propertyDef) {
/* @var $propertyDef \PHPCR\NodeType\PropertyDefinitionInterface */
if ($propertyDef->getName() == '*') {
continue;
@@ -874,7 +874,7 @@ private function getResponsibleNodeTypes($node)
array_unshift($nodeTypes, $nodeDef);
foreach ($nodeTypes as $nodeType) {
/* @var $nodeType \PHPCR\NodeType\NodeTypeDefinitionInterface */
- foreach ($nodeType->getDeclaredSupertypes() AS $superType) {
+ foreach ($nodeType->getDeclaredSupertypes() as $superType) {
$nodeTypes[] = $superType;
}
}
@@ -889,7 +889,7 @@ public function storeNode(\PHPCR\NodeInterface $node)
$nodeTypes = $this->getResponsibleNodeTypes($node);
$popertyDefs = array();
- foreach ($nodeTypes AS $nodeType) {
+ foreach ($nodeTypes as $nodeType) {
/* @var $nodeType \PHPCR\NodeType\NodeTypeDefinitionInterface */
$this->validateNode($node, $nodeType);
}
@@ -980,13 +980,13 @@ public function getNodeTypes($nodeTypes = array())
$data = PHPCR2StandardNodeTypes::getNodeTypeData();
$filteredData = array();
- foreach ($data AS $nodeTypeData) {
+ foreach ($data as $nodeTypeData) {
if (isset($nodeTypes[$nodeTypeData['name']])) {
$filteredData[$nodeTypeData['name']] = $nodeTypeData;
}
}
- foreach ($nodeTypes AS $type => $val) {
+ foreach ($nodeTypes as $type => $val) {
if (!isset($filteredData[$type]) && $result = $this->fetchUserNodeType($type)) {
$filteredData[$type] = $result;
}
@@ -1030,7 +1030,7 @@ private function fetchUserNodeType($name)
$query = "SELECT * FROM phpcr_type_props WHERE node_type_id = ?";
$props = $this->conn->fetchAll($query, array($data['node_type_id']));
- foreach ($props AS $propertyData) {
+ foreach ($props as $propertyData) {
$result['declaredPropertyDefinitions'][] = array(
'declaringNodeType' => $data['name'],
'name' => $propertyData['name'],
@@ -1058,7 +1058,7 @@ private function fetchUserNodeType($name)
$query = "SELECT * FROM phpcr_type_childs WHERE node_type_id = ?";
$childs = $this->conn->fetchAll($query, array($data['node_type_id']));
- foreach ($childs AS $childData) {
+ foreach ($childs as $childData) {
$result['declaredNodeDefinitions'][] = array(
'declaringNodeType' => $data['name'],
'name' => $childData['name'],
@@ -1086,7 +1086,7 @@ public function registerNodeTypesCnd($cnd, $allowUpdate)
// inherit all doc
public function registerNodeTypes($types, $allowUpdate)
{
- foreach ($types AS $type) {
+ foreach ($types as $type) {
/* @var $type \Jackalope\NodeType\NodeTypeDefinition */
$this->conn->insert('phpcr_type_nodes', array(
'name' => $type->getName(),
@@ -1100,7 +1100,7 @@ public function registerNodeTypes($types, $allowUpdate)
$nodeTypeId = $this->conn->lastInsertId($this->sequenceTypeName);
if ($propDefs = $type->getDeclaredPropertyDefinitions()) {
- foreach ($propDefs AS $propertyDef) {
+ foreach ($propDefs as $propertyDef) {
/* @var $propertyDef \Jackalope\NodeType\PropertyDefinition */
$this->conn->insert('phpcr_type_props', array(
'node_type_id' => $nodeTypeId,
@@ -1120,7 +1120,7 @@ public function registerNodeTypes($types, $allowUpdate)
}
if ($childDefs = $type->getDeclaredChildNodeDefinitions()) {
- foreach ($childDefs AS $childDef) {
+ foreach ($childDefs as $childDef) {
/* @var $propertyDef \PHPCR\NodeType\NodeDefinitionInterface */
$this->conn->insert('phpcr_type_childs', array(
'node_type_id' => $nodeTypeId,
@@ -1168,7 +1168,7 @@ public function getBinaryStream($path)
return fopen("data://text/plain,".$data[0]['data'], "r");
} else {
$streams = array();
- foreach ($data AS $row) {
+ foreach ($data as $row) {
$streams[$row['idx']] = fopen("data://text/plain,".$row['data'], "r");
}
return $streams;
@@ -1201,7 +1201,7 @@ public function query(\PHPCR\Query\QueryInterface $query)
$data = $this->conn->fetchAll($sql, array($this->workspaceId));
$result = array();
- foreach ($data AS $row) {
+ foreach ($data as $row) {
$result[] = array(
array('dcr:name' => 'jcr:primaryType', 'dcr:value' => $row['type']),
array('dcr:name' => 'jcr:path', 'dcr:value' => $row['path'], 'dcr:selectorName' => $row['type']),
@@ -1251,13 +1251,13 @@ protected function getNodeReferences($path, $name = null, $weakReference = false
$type = $weakReference ? \PHPCR\PropertyType::WEAKREFERENCE : \PHPCR\PropertyType::REFERENCE;
- $sql = "SELECT CONCAT(n.path, '/', fk.source_property_name) AS path, fk.source_property_name FROM phpcr_nodes n " .
+ $sql = "SELECT CONCAT(n.path, '/', fk.source_property_name) as path, fk.source_property_name FROM phpcr_nodes n " .
"INNER JOIN phpcr_nodes_foreignkeys fk ON n.id = fk.source_id ".
"WHERE fk.target_id = ? AND fk.type = ?";
$properties = $this->conn->fetchAll($sql, array($targetId, $type));
$references = array();
- foreach ($properties AS $property) {
+ foreach ($properties as $property) {
if ($name === null || $property['source_property_name'] == $name) {
$references[] = $property['path'];
}
View
2  src/Jackalope/Transport/DoctrineDBAL/Query/QOMWalker.php
@@ -265,7 +265,7 @@ public function walkOperand(QOM\OperandInterface $operand)
public function walkOrderings(array $orderings)
{
$sql = "ORDER BY ";
- foreach ($orderings AS $ordering) {
+ foreach ($orderings as $ordering) {
$sql .= $this->walkOrdering($ordering);
}
return $sql;
View
6 tests/Jackalope/TestCase.php
@@ -19,7 +19,7 @@ protected function setUp()
$this->credentials = new \PHPCR\SimpleCredentials($this->config['user'], $this->config['pass']);
}
- protected function getTransportStub($path)
+ protected function getTransportStub()
{
$factory = new \Jackalope\Factory;
$transport = $this->getMock('\Jackalope\Transport\Jackrabbit\Client', array('getNode', 'getNodeTypes', 'getNodePathForIdentifier'), array($factory, 'http://example.com'));
@@ -29,7 +29,7 @@ protected function getTransportStub($path)
->will($this->returnValue(json_decode($this->JSON)));
$dom = new \DOMDocument();
- $dom->load(dirname(__FILE__) . '/../fixtures/nodetypes.xml');
+ $dom->load(__DIR__ . '/../fixtures/nodetypes.xml');
$transport->expects($this->any())
->method('getNodeTypes')
->will($this->returnValue($dom));
@@ -91,7 +91,7 @@ protected function getNodeTypeManager()
{
$factory = new \Jackalope\Factory;
$dom = new \DOMDocument();
- $dom->load(dirname(__FILE__) . '/../fixtures/nodetypes.xml');
+ $dom->load(__DIR__ . '/../fixtures/nodetypes.xml');
$converter = new \Jackalope\NodeType\NodeTypeXmlConverter($factory);
$om = $this->getObjectManagerMock();
$om->expects($this->any())
View
4 tests/Jackalope/Transport/DoctrineDBAL/ClientTest.php
@@ -23,7 +23,7 @@ public function setUp()
$conn = $this->getConnection();
$schema = RepositorySchema::create();
- foreach ($schema->toDropSql($conn->getDatabasePlatform()) AS $statement) {
+ foreach ($schema->toDropSql($conn->getDatabasePlatform()) as $statement) {
try {
$conn->exec($statement);
} catch(\Exception $e) {
@@ -31,7 +31,7 @@ public function setUp()
}
}
- foreach ($schema->toSql($conn->getDatabasePlatform()) AS $statement) {
+ foreach ($schema->toSql($conn->getDatabasePlatform()) as $statement) {
$conn->exec($statement);
}
View
30 tests/Jackalope/Transport/Jackrabbit/ClientTest.php
@@ -10,7 +10,7 @@
/**
* TODO: this unit test contains some functional tests. we should separate functional and unit tests.
*/
-class ClientTest extends DavexTestCase
+class ClientTest extends JackrabbitTestCase
{
public function getTransportMock($args = 'testuri', $changeMethods = array())
{
@@ -101,7 +101,7 @@ public function testBuildReportRequest()
public function testGetRepositoryDescriptorsEmptyBackendResponse()
{
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/empty.xml');
+ $dom->load(__DIR__.'/../../../fixtures/empty.xml');
$t = $this->getTransportMock();
$request = $this->getRequestMock($dom, array('setBody'));
$t->expects($this->once())
@@ -117,7 +117,7 @@ public function testGetRepositoryDescriptors()
{
$reportRequest = $this->getTransportMock()->buildReportRequestMock('dcr:repositorydescriptors');
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/repositoryDescriptors.xml');
+ $dom->load(__DIR__.'/../../../fixtures/repositoryDescriptors.xml');
$t = $this->getTransportMock();
$request = $this->getRequestMock($dom, array('setBody'));
$t->expects($this->once())
@@ -209,7 +209,7 @@ public function testLoginUnsportedCredentials()
public function testLoginEmptyBackendResponse()
{
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/empty.xml');
+ $dom->load(__DIR__.'/../../../fixtures/empty.xml');
$t = $this->getTransportMock();
$request = $this->getRequestMock($dom, array('setBody'));
$t->expects($this->once())
@@ -225,7 +225,7 @@ public function testLoginEmptyBackendResponse()
public function testLoginWrongWorkspace()
{
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/wrongWorkspace.xml');
+ $dom->load(__DIR__.'/../../../fixtures/wrongWorkspace.xml');
$t = $this->getTransportMock();
$request = $this->getRequestMock($dom, array('setBody'));
$t->expects($this->once())
@@ -241,7 +241,7 @@ public function testLogin()
{
$propfindRequest = $this->getTransportMock()->buildPropfindRequestMock(array('D:workspace', 'dcr:workspaceName'));
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/loginResponse.xml');
+ $dom->load(__DIR__.'/../../../fixtures/loginResponse.xml');
$t = $this->getTransportMock();
$request = $this->getRequestMock($dom, array('setBody'));
@@ -325,7 +325,7 @@ public function testBuildLocateRequestMock()
public function testGetNodePathForIdentifierEmptyResponse()
{
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/empty.xml');
+ $dom->load(__DIR__.'/../../../fixtures/empty.xml');
$t = $this->getTransportMock('testuri');
$request = $this->getRequestMock($dom, array('setBody'));
@@ -343,7 +343,7 @@ public function testGetNodePathForIdentifierWrongWorkspace()
{
$locateRequest = $this->getTransportMock()->buildLocateRequestMock('test');
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/locateRequest.xml');
+ $dom->load(__DIR__.'/../../../fixtures/locateRequest.xml');
$t = $this->getTransportMock('testuri');
$request = $this->getRequestMock($dom, array('setBody'));
@@ -364,7 +364,7 @@ public function testGetNodePathForIdentifier()
{
$locateRequest = $this->getTransportMock()->buildLocateRequestMock('test');
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/locateRequestTests.xml');
+ $dom->load(__DIR__.'/../../../fixtures/locateRequestTests.xml');
$t = $this->getTransportMock('testuri');
$request = $this->getRequestMock($dom, array('setBody'));
@@ -385,7 +385,7 @@ public function testGetNodePathForIdentifier()
public function testGetNamespacesEmptyResponse()
{
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/empty.xml');
+ $dom->load(__DIR__.'/../../../fixtures/empty.xml');
$t = $this->getTransportMock($this->config['url']);
$request = $this->getRequestMock($dom, array('setBody'));
@@ -403,7 +403,7 @@ public function testGetNamespaces()
{
$reportRequest = $this->getTransportMock()->buildReportRequestMock('dcr:registerednamespaces');
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/registeredNamespaces.xml');
+ $dom->load(__DIR__.'/../../../fixtures/registeredNamespaces.xml');
$t = $this->getTransportMock($this->config['url']);
$request = $this->getRequestMock($dom, array('setBody'));
@@ -466,7 +466,7 @@ public function testSpecificNodeTypesRequest()
*/
public function testGetNodeTypes()
{
- $t = $this->setUpNodeTypeMock(array(), dirname(__FILE__).'/../../../fixtures/nodetypes.xml');
+ $t = $this->setUpNodeTypeMock(array(), __DIR__.'/../../../fixtures/nodetypes.xml');
$nt = $t->getNodeTypes();
$this->assertInternalType('array', $nt);
@@ -478,7 +478,7 @@ public function testGetNodeTypes()
*/
public function testSpecificGetNodeTypes()
{
- $t = $this->setUpNodeTypeMock(array('nt:folder', 'nt:file'), dirname(__FILE__).'/../../../fixtures/small_nodetypes.xml');
+ $t = $this->setUpNodeTypeMock(array('nt:folder', 'nt:file'), __DIR__.'/../../../fixtures/small_nodetypes.xml');
$nt = $t->getNodeTypes(array('nt:folder', 'nt:file'));
$this->assertInternalType('array', $nt);
@@ -492,7 +492,7 @@ public function testSpecificGetNodeTypes()
*/
public function testEmptyGetNodeTypes()
{
- $t = $this->setUpNodeTypeMock(array(), dirname(__FILE__).'/../../../fixtures/empty.xml');
+ $t = $this->setUpNodeTypeMock(array(), __DIR__.'/../../../fixtures/empty.xml');
$this->setExpectedException('\PHPCR\RepositoryException');
$nt = $t->getNodeTypes();
@@ -506,7 +506,7 @@ public function testEmptyGetNodeTypes()
public function testGetAccessibleWorkspaceNames()
{
$dom = new DOMDocument();
- $dom->load(dirname(__FILE__).'/../../../fixtures/accessibleWorkspaces.xml');
+ $dom->load(__DIR__.'/../../../fixtures/accessibleWorkspaces.xml');
$t = $this->getTransportMock('testuri');
$request = $this->getRequestMock($dom, array('setBody', 'setDepth'));
View
2  .../Jackalope/Transport/Jackrabbit/DavexTestCase.php → ...alope/Transport/Jackrabbit/JackrabbitTestCase.php
@@ -4,7 +4,7 @@
use Jackalope\TestCase;
-abstract class DavexTestCase extends TestCase
+abstract class JackrabbitTestCase extends TestCase
{
public function setUp()
{
View
2  tests/Jackalope/Transport/Jackrabbit/RequestTest.php
@@ -7,7 +7,7 @@
use DOMDocument;
use DOMXPath;
-class RequestTest extends DavexTestCase
+class RequestTest extends JackrabbitTestCase
{
protected function getCurlFixture($fixture = null, $httpCode = 200, $errno = null)
{
View
10 tests/bootstrap_doctrine.php → tests/bootstrap_doctrine_dbal.php
@@ -20,7 +20,7 @@
}
}
-require_once($GLOBALS['phpcr.doctrine.loader']);
+require_once $GLOBALS['phpcr.doctrine.loader'];
$loader = new \Doctrine\Common\ClassLoader("Doctrine\Common", $GLOBALS['phpcr.doctrine.commondir']);
$loader->register();
@@ -31,11 +31,11 @@
/**
* autoloader: tests rely on an autoloader.
*/
-require_once(dirname(__FILE__) . '/../src/Jackalope/autoloader.php');
+require_once __DIR__ . '/../src/Jackalope/autoloader.php';
### Load classes needed for jackalope unit tests ###
require 'Jackalope/TestCase.php';
-require 'Jackalope/Transport/Jackrabbit/DavexTestCase.php';
+require 'Jackalope/Transport/Jackrabbit/JackrabbitTestCase.php';
require 'Jackalope/Transport/DoctrineDBAL/DoctrineDBALTestCase.php';
### Load the implementation loader class ###
@@ -53,14 +53,14 @@
));
echo "Updating schema...";
$schema = \Jackalope\Transport\DoctrineDBAL\RepositorySchema::create();
-foreach ($schema->toDropSql($dbConn->getDatabasePlatform()) AS $sql) {
+foreach ($schema->toDropSql($dbConn->getDatabasePlatform()) as $sql) {
try {
$dbConn->exec($sql);
} catch(PDOException $e) {
echo $e->getMessage();
}
}
-foreach ($schema->toSql($dbConn->getDatabasePlatform()) AS $sql) {
+foreach ($schema->toSql($dbConn->getDatabasePlatform()) as $sql) {
try {
$dbConn->exec($sql);
} catch(PDOException $e) {
View
2  tests/bootstrap_jackrabbit.php
@@ -19,7 +19,7 @@
### Load classes needed for jackalope unit tests ###
require 'Jackalope/TestCase.php';
-require 'Jackalope/Transport/Jackrabbit/DavexTestCase.php';
+require 'Jackalope/Transport/Jackrabbit/JackrabbitTestCase.php';
require 'Jackalope/Transport/DoctrineDBAL/DoctrineDBALTestCase.php';
### Load the implementation loader class ###
View
16 tests/convert_doctrine_fixtures.php → tests/generate_doctrine_dbal_fixture.php
@@ -30,7 +30,7 @@
$ri = new RecursiveIteratorIterator($rdi);
libxml_use_internal_errors(true);
-foreach ($ri AS $file) {
+foreach ($ri as $file) {
if (!$file->isFile()) { continue; }
$newFile = str_replace($srcDir, $destDir, $file->getPathname());
@@ -79,7 +79,7 @@
));
$nodeIds[$id] = $nodeId;
- foreach ($nodes AS $node) {
+ foreach ($nodes as $node) {
/* @var $node DOMElement */
$parent = $node;
$path = "";
@@ -91,12 +91,12 @@
} while ($parent instanceof DOMElement);
$attrs = array();
- foreach ($node->childNodes AS $child) {
+ foreach ($node->childNodes as $child) {
if ($child instanceof DOMElement && $child->tagName == "sv:property") {
$name = $child->getAttributeNS('http://www.jcp.org/jcr/sv/1.0', 'name');
$value = array();
- foreach ($child->getElementsByTagNameNS('http://www.jcp.org/jcr/sv/1.0', 'value') AS $nodeValue) {
+ foreach ($child->getElementsByTagNameNS('http://www.jcp.org/jcr/sv/1.0', 'value') as $nodeValue) {
$value[] = $nodeValue->nodeValue;
}
@@ -138,7 +138,7 @@
$dom->appendChild($rootNode);
$binaryData = null;
- foreach ($attrs AS $attr => $valueData) {
+ foreach ($attrs as $attr => $valueData) {
if ($attr == "jcr:uuid") {
continue;
}
@@ -152,7 +152,7 @@
$propertyNode->setAttribute('sv:type', $jcrTypeConst); // TODO: Name! not int
$propertyNode->setAttribute('sv:multi-valued', $valueData['multiValued'] ? "1" : "0");
- foreach ($valueData['value'] AS $value) {
+ foreach ($valueData['value'] as $value) {
switch ($valueData['type']) {
case 'binary':
$binaryData = base64_decode($value);
@@ -252,7 +252,7 @@ public function addRow($tableName, array $data)
if (!isset($this->tables[$tableName])) {
$table = $this->dom->createElement('table');
$table->setAttribute('name', $tableName);
- foreach ($data AS $k => $v) {
+ foreach ($data as $k => $v) {
$table->appendChild($this->dom->createElement('column', $k));
}
$this->tables[$tableName] = $table;
@@ -260,7 +260,7 @@ public function addRow($tableName, array $data)
}
$row = $this->dom->createElement('row');
- foreach ($data AS $k => $v) {
+ foreach ($data as $k => $v) {
if ($v === null) {
$row->appendChild($this->dom->createElement('null'));
} else {
View
3  tests/inc/DoctrineFixtureLoader.php → tests/inc/DoctrineDBALFixtureLoader.php
@@ -1,10 +1,11 @@
<?php
+
require_once __DIR__.'/../phpcr-api/inc/FixtureLoaderInterface.php';
/**
* Import fixtures into the doctrine dbal backend of jackalope
*/
-class DoctrineFixtureLoader implements \PHPCR\Test\FixtureLoaderInterface
+class DoctrineDBALFixtureLoader implements \PHPCR\Test\FixtureLoaderInterface
{
private $testConn;
private $fixturePath;
View
8 tests/inc/DoctrineDBALImplementationLoader.php
@@ -65,7 +65,7 @@ public static function getInstance()
public function getRepositoryFactoryParameters()
{
- global $dbConn; // initialized in bootstrap_doctrine.php
+ global $dbConn; // initialized in bootstrap_doctrine_dbal.php
return array('jackalope.doctrine_dbal_connection' => $dbConn);
}
@@ -93,7 +93,7 @@ function getRepository()
{
global $dbConn;
- $dbConn->insert('phpcr_workspaces', array('name' => $this->config['workspace']));
+ $dbConn->insert('phpcr_workspaces', array('name' => $GLOBALS['phpcr.workspace']));
$transport = new \Jackalope\Transport\DoctrineDBAL\Client(new \Jackalope\Factory, $dbConn);
$GLOBALS['pdo'] = $dbConn->getWrappedConnection();
return new \Jackalope\Repository(null, $transport);
@@ -112,7 +112,7 @@ public function getTestSupported($chapter, $case, $name)
function getFixtureLoader()
{
- require_once "DoctrineFixtureLoader.php";
- return new \DoctrineFixtureLoader($GLOBALS['pdo'], __DIR__ . "/../fixtures/doctrine/");
+ require_once "DoctrineDBALFixtureLoader.php";
+ return new DoctrineDBALFixtureLoader($GLOBALS['pdo'], __DIR__ . "/../fixtures/doctrine/");
}
}
View
10 tests/inc/JackrabbitFixtureLoader.php
@@ -20,13 +20,13 @@ class JackrabbitFixtureLoader implements \PHPCR\Test\FixtureLoaderInterface
protected $jar;
/**
- * @param string $fixturePath path to the fixtures directory. defaults to dirname(__FILE__) . '/suite/fixtures/'
- * @param string $jackjar path to the jar file for import-export. defaults to dirname(__FILE__) . '/bin/jack.jar'
+ * @param string $fixturePath path to the fixtures directory. defaults to __DIR__ . '/suite/fixtures/'
+ * @param string $jackjar path to the jar file for import-export. defaults to __DIR__ . '/bin/jack.jar'
*/
public function __construct($fixturePath = null, $jackjar = null)
{
if (is_null($fixturePath)) {
- $this->fixturePath = dirname(__FILE__) . '/../phpcr-api/fixtures/';
+ $this->fixturePath = __DIR__ . '/../phpcr-api/fixtures/';
} else {
$this->fixturePath = $fixturePath;
}
@@ -35,7 +35,7 @@ public function __construct($fixturePath = null, $jackjar = null)
}
if (is_null($jackjar)) {
- $this->jar = dirname(__FILE__) . '/../bin/jack.jar';
+ $this->jar = __DIR__ . '/../bin/jack.jar';
} else {
$this->jar = $jackjar;
}
@@ -54,7 +54,7 @@ private function getArguments()
'phpcr.basepath' => 'repository-base-xpath',
);
$opts = "";
- foreach ($args AS $arg => $newArg) {
+ foreach ($args as $arg => $newArg) {
if (isset($GLOBALS[$arg])) {
if ($opts != "") {
$opts .= " ";
View
11 tests/phpunit_doctrinedbal.xml.dist → tests/phpunit_doctrine_dbal.xml.dist
@@ -7,15 +7,15 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
- bootstrap="bootstrap_doctrine.php">
+ bootstrap="bootstrap_doctrine_dbal.php">
<php>
<var name="phpcr.user" value="admin" />
<var name="phpcr.pass" value="admin" />
<var name="phpcr.workspace" value="tests" />
<!-- Path to Doctrine stuff for transport -->
- <var name="phpcr.doctrine.loader" value="/path/to/Doctrine/Common/lib/Doctrine/Common/ClassLoader.php" />
- <var name="phpcr.doctrine.commondir" value="/path/to/Doctrine/Common/lib" />
- <var name="phpcr.doctrine.dbaldir" value="/path/to/Doctrine/dbal/lib" />
+ <var name="phpcr.doctrine.loader" value="./tests/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php" />
+ <var name="phpcr.doctrine.commondir" value="./tests/vendor/doctrine-common/lib" />
+ <var name="phpcr.doctrine.dbaldir" value="./tests/vendor/doctrine-dbal/lib" />
<var name="phpcr.doctrine.dbal.driver" value="pdo_mysql" />
<var name="phpcr.doctrine.dbal.host" value="localhost" />
<var name="phpcr.doctrine.dbal.username" value="root" />
@@ -25,7 +25,8 @@
<testsuites>
<testsuite name="Jackalope Doctrine DBAL Tests">
- <directory>.</directory>
+ <directory>./Jackalope</directory>
+ <directory>./phpcr-api/</directory>
<exclude>./Jackalope/Transport/Jackrabbit</exclude>
</testsuite>
</testsuites>
View
11 tests/phpunit_jackrabbit.xml.dist
@@ -18,17 +18,10 @@
<testsuites>
<testsuite name="Jackalope Jackrabbit Tests">
- <directory>.</directory>
+ <directory>./Jackalope</directory>
+ <directory>./phpcr-api/</directory>
<exclude>./Jackalope/Transport/DoctrineDBAL</exclude>
</testsuite>
- <!-- if phpunit would support the full power of its config format, we
- could add more test suites to allow the user to specify which
- tests to run. as it is, you can specify the directy you want to
- limit tests to on the command line.
- <testsuite name="Jackalope API Tests">
- <directory>phpcr-api/</directory>
- </testsuite>
- -->
</testsuites>
<!-- configuration for code coverage report -->
Please sign in to comment.
Something went wrong with that request. Please try again.