Skip to content

Update infrastructure #161

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

Merged
merged 7 commits into from
Jul 24, 2015
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
32 changes: 32 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

$header = <<<EOF
This file is part of the PHPCR API Tests package

Copyright (c) 2015 Liip and others

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

// Run the phpcsfixer from this directory to fix all code style issues
// https://github.com/FriendsOfPHP/PHP-CS-Fixer

Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when / how is this triggered?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would need to be executed manually: /path/to/phpcsfixer fix

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have that in a doc comment then.


return Symfony\CS\Config\Config::create()
->fixers(array(
'header_comment',
'-psr0',
'psr4',
'symfony',
'concat_without_spaces',
'-phpdoc_indent',
'-phpdoc_params',
))
->finder(
Symfony\CS\Finder\DefaultFinder::create()
->exclude('vendor')
->in(__DIR__)
)
;
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ phpcr-api-tests is dual licensed under the MIT license and the Apache License Ve

The MIT License (MIT)

Copyright (c) 2013 Liip and others
Copyright (c) 2015 Liip and others

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
12 changes: 11 additions & 1 deletion bootstrap.dist.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<?php

/*
* This file is part of the PHPCR API Tests package
*
* Copyright (c) 2015 Liip and others
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/** make sure we get ALL infos from php */
error_reporting(E_ALL | E_STRICT);

/**
/*
* Sample bootstrap file
*
* the thing you MUST do is define the constants as expected in the
Expand Down
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
"php": ">=5.3.0",
"phpcr/phpcr-implementation": "2.1.*"
},
"autoload": {
"psr-4": {
"PHPCR\\Test\\": "inc/",
"PHPCR\\Tests\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
Expand Down
2 changes: 1 addition & 1 deletion fixtures/06_Query/characters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
</sv:node>
</sv:node>
</sv:node>
</sv:node>
</sv:node>
1 change: 0 additions & 1 deletion fixtures/10_Writing/mixinreferenceable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,3 @@
</sv:property>
</sv:node>
</sv:node>

2 changes: 1 addition & 1 deletion fixtures/11_Import/simple.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
<child/>
</yetanother>
</sibling>
</data>
</data>
2 changes: 1 addition & 1 deletion fixtures/general/query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
<sv:value>SELECT * FROM [nt:file] WHERE [nt:file].[jcr:mimeType] = "text/plain"</sv:value>
</sv:property>
</sv:node>
</sv:node>
</sv:node>
49 changes: 30 additions & 19 deletions inc/AbstractLoader.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the PHPCR API Tests package
*
* Copyright (c) 2015 Liip and others
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace PHPCR\Test;

use PHPCR\NoSuchWorkspaceException;
Expand All @@ -18,20 +27,20 @@ abstract class AbstractLoader
protected $otherWorkspacename;

/**
* array with chapter names to skip all test cases in (without the numbers)
* array with chapter names to skip all test cases in (without the numbers).
*/
protected $unsupportedChapters = array();
/**
* array in the format Chapter\FeatureTest with all cases to skip
* array in the format Chapter\FeatureTest with all cases to skip.
*/
protected $unsupportedCases = array();
/**
* array in the format Chapter\FeatureTest::testName with all single tests to skip
* array in the format Chapter\FeatureTest::testName with all single tests to skip.
*/
protected $unsupportedTests = array();

/**
* Create the loader
* Create the loader.
*
* @param string $factoryclass the class name of your implementations
* RepositoryFactory. You can pass null but then you must overwrite
Expand Down Expand Up @@ -71,7 +80,7 @@ public function getRepositoryFactoryClass()
/**
* @return array hashmap with the parameters for the repository factory
*/
public abstract function getRepositoryFactoryParameters();
abstract public function getRepositoryFactoryParameters();

/**
* You should overwrite this to instantiate the repository without the
Expand All @@ -85,39 +94,38 @@ public abstract function getRepositoryFactoryParameters();
public function getRepository()
{
$factoryclass = $this->getRepositoryFactoryClass();
$factory = new $factoryclass;
if (! $factory instanceof RepositoryFactoryInterface) {
$factory = new $factoryclass();
if (!$factory instanceof RepositoryFactoryInterface) {
throw new \Exception("$factoryclass is not of type RepositoryFactoryInterface");
}
/** @var $factory RepositoryFactoryInterface */
/* @var $factory RepositoryFactoryInterface */
return $factory->getRepository($this->getRepositoryFactoryParameters());
}

/**
* @return \PHPCR\CredentialsInterface the login credentials that lead to successful login into the repository
*/
public abstract function getCredentials();
abstract public function getCredentials();

/**
* @return \PHPCR\CredentialsInterface the login credentials that lead to login failure
*/
public abstract function getInvalidCredentials();
abstract public function getInvalidCredentials();

/**
* Used when impersonating another user in Reading\SessionReadMethodsTests::testImpersonate
* And for Reading\SessionReadMethodsTest::testCheckPermissionAccessControlException
* And for Reading\SessionReadMethodsTest::testCheckPermissionAccessControlException.
*
* The user may not have write access to /tests_general_base/numberPropertyNode/jcr:content/foo
*
* @return \PHPCR\CredentialsInterface the login credentials with limited permissions for testing impersonate and access control
*/
public abstract function getRestrictedCredentials();
abstract public function getRestrictedCredentials();

/**
* @return string the user id that is used in the credentials
*/
public abstract function getUserId();

abstract public function getUserId();

/**
* Make the repository ready for login with null credentials, handling the
Expand All @@ -126,9 +134,9 @@ public abstract function getUserId();
* If the implementation does not support this feature, it must return
* false for this method, otherwise true.
*
* @return boolean true if anonymous login is supposed to work
* @return bool true if anonymous login is supposed to work
*/
public abstract function prepareAnonymousLogin();
abstract public function prepareAnonymousLogin();

/**
* @return string the workspace name used for the tests
Expand Down Expand Up @@ -158,6 +166,7 @@ public function getOtherWorkspaceName()
* Get a session for this implementation.
*
* @param \PHPCR\CredentialsInterface $credentials The credentials to log into the repository. If omitted, self::getCredentials should be used
*
* @return \PHPCR\SessionInterface the session resulting from logging into the repository with the provided credentials
*/
public function getSession($credentials = false)
Expand All @@ -169,6 +178,7 @@ public function getSession($credentials = false)
* Get a session corresponding to the additional workspace for this implementation.
*
* @param \PHPCR\CredentialsInterface $credentials The credentials to log into the repository. If omitted, self::getCredentials should be used
*
* @return \PHPCR\SessionInterface the session resulting from logging into the repository with the provided credentials
*/
public function getAdditionalSession($credentials = false)
Expand Down Expand Up @@ -202,7 +212,7 @@ public function getSessionWithLastModified()
* mix:lastModified. If that is not possible, this method should return
* true, which will skip the test about this feature.
*
* @return boolean
* @return bool
*/
public function doesSessionLastModified()
{
Expand All @@ -223,7 +233,7 @@ public function doesSessionLastModified()
*/
public function getTestSupported($chapter, $case, $name)
{
return ! ( in_array($chapter, $this->unsupportedChapters)
return !(in_array($chapter, $this->unsupportedChapters)
|| in_array($case, $this->unsupportedCases)
|| in_array($name, $this->unsupportedTests)
);
Expand All @@ -232,11 +242,12 @@ public function getTestSupported($chapter, $case, $name)
/**
* @return \PHPCR\Test\FixtureLoaderInterface implementation that is used to load test fixtures
*/
public abstract function getFixtureLoader();
abstract public function getFixtureLoader();

/**
* @param $credentials
* @param $workspaceName
*
* @return mixed
*/
private function getSessionForWorkspace($credentials, $workspaceName)
Expand Down
Loading