Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated cs fixer #182

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Jackalope/Transport/Jackrabbit/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ private function generateLockFromDavResponse($response, bool $sessionOwning = fa
*
* @return bool|\DOMNode
*
* @throws \PHPCR\RepositoryException When the element is not found and an $errorMessage is set
* @throws RepositoryException When the element is not found and an $errorMessage is set
*/
private function getRequiredDomElementByTagNameNS($dom, string $namespace, string $element, string $errorMessage = '')
{
Expand Down
35 changes: 21 additions & 14 deletions tests/ImplementationLoader.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<?php

use Jackalope\RepositoryFactoryJackrabbit;
use Jackalope\Session;
use Jackalope\Transport\Logging\Psr3Logger;
use PHPCR\SimpleCredentials;
use PHPCR\Test\AbstractLoader;
use Psr\Log\NullLogger;

/**
* Implementation loader for jackalope-jackrabbit.
*/
class ImplementationLoader extends \PHPCR\Test\AbstractLoader
class ImplementationLoader extends AbstractLoader
{
private static $instance;

Expand All @@ -25,16 +32,16 @@ protected function __construct()
}
}

parent::__construct('Jackalope\RepositoryFactoryJackrabbit', $GLOBALS['phpcr.workspace'], $GLOBALS['phpcr.additionalWorkspace']);
parent::__construct(RepositoryFactoryJackrabbit::class, $GLOBALS['phpcr.workspace'], $GLOBALS['phpcr.additionalWorkspace']);

// ensure workspaces exist
$workspace = $this->getRepository()->login($this->getCredentials())->getWorkspace();
if (!in_array($GLOBALS['phpcr.workspace'], $workspace->getAccessibleWorkspaceNames())) {
if (!in_array($GLOBALS['phpcr.workspace'], $workspace->getAccessibleWorkspaceNames(), true)) {
$workspace->createWorkspace($GLOBALS['phpcr.workspace']);
}
if (false == $GLOBALS['phpcr.additionalWorkspace']) {
if (!$GLOBALS['phpcr.additionalWorkspace']) {
$this->multiWorkspaceSupported = false;
} elseif (!in_array($GLOBALS['phpcr.additionalWorkspace'], $workspace->getAccessibleWorkspaceNames())) {
} elseif (!in_array($GLOBALS['phpcr.additionalWorkspace'], $workspace->getAccessibleWorkspaceNames(), true)) {
$workspace->createWorkspace($GLOBALS['phpcr.additionalWorkspace']);
}

Expand Down Expand Up @@ -115,33 +122,33 @@ public function getRepositoryFactoryParameters()
{
return [
'jackalope.jackrabbit_uri' => $GLOBALS['jackrabbit.uri'],
\Jackalope\Session::OPTION_AUTO_LASTMODIFIED => false,
'jackalope.logger' => new \Jackalope\Transport\Logging\Psr3Logger(new \Psr\Log\NullLogger()),
Session::OPTION_AUTO_LASTMODIFIED => false,
'jackalope.logger' => new Psr3Logger(new NullLogger()),
];
}

public function getSessionWithLastModified()
{
/** @var $session \Jackalope\Session */
/** @var $session Session */
$session = $this->getSession();
$session->setSessionOption(\Jackalope\Session::OPTION_AUTO_LASTMODIFIED, true);
$session->setSessionOption(Session::OPTION_AUTO_LASTMODIFIED, true);

return $session;
}

public function getCredentials()
{
return new \PHPCR\SimpleCredentials($GLOBALS['phpcr.user'], $GLOBALS['phpcr.pass']);
return new SimpleCredentials($GLOBALS['phpcr.user'], $GLOBALS['phpcr.pass']);
}

public function getInvalidCredentials()
{
return new \PHPCR\SimpleCredentials('nonexistinguser', '');
return new SimpleCredentials('nonexistinguser', '');
}

public function getRestrictedCredentials()
{
return new \PHPCR\SimpleCredentials('anonymous', 'abc');
return new SimpleCredentials('anonymous', 'abc');
}

public function prepareAnonymousLogin()
Expand All @@ -154,8 +161,8 @@ public function getUserId()
return $GLOBALS['phpcr.user'];
}

public function getFixtureLoader()
public function getFixtureLoader(): JackrabbitFixtureLoader
{
return new JackrabbitFixtureLoader(__DIR__.'/../vendor/phpcr/phpcr-api-tests/fixtures/', isset($GLOBALS['jackrabbit.jar']) ? $GLOBALS['jackrabbit.jar'] : null);
return new JackrabbitFixtureLoader(__DIR__.'/../vendor/phpcr/phpcr-api-tests/fixtures/', $GLOBALS['jackrabbit.jar'] ?? null);
}
}
3 changes: 2 additions & 1 deletion tests/Jackalope/Transport/Jackrabbit/PrefetchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Jackalope\Transport\Jackrabbit;

use Jackalope\Factory;
use Jackalope\TestCase;

/**
Expand Down Expand Up @@ -53,7 +54,7 @@ public static function setUpBeforeClass(): void

protected function getTransport(): Client
{
$transport = new \Jackalope\Transport\Jackrabbit\Client(new \Jackalope\Factory(), $GLOBALS['jackrabbit.uri']);
$transport = new Client(new Factory(), $GLOBALS['jackrabbit.uri']);
$transport->login(self::$loader->getCredentials(), self::$loader->getWorkspaceName());

return $transport;
Expand Down
4 changes: 3 additions & 1 deletion tests/JackrabbitFixtureLoader.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use PHPCR\Test\FixtureLoaderInterface;

/**
* Handles basic importing and exporting of fixtures trough
* the java binary jack.jar.
Expand All @@ -12,7 +14,7 @@
* <var name="phpcr.workspace" value="tests" />
* </php>
*/
class JackrabbitFixtureLoader implements \PHPCR\Test\FixtureLoaderInterface
class JackrabbitFixtureLoader implements FixtureLoaderInterface
{
protected $fixturePath;
protected $jar;
Expand Down