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

Update ORM to 2.11 #455

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"name": "stfc-egi/gocdb",
"description": "A web portal and REST style API for e-Infrastructure topology managment",
"require": {
"doctrine/orm": "2.5.14"
"doctrine/orm": "2.11.*",
"symfony/cache": "*",
"doctrine/annotations": "*"
},
"require-dev": {
"phpunit/phpunit": "4.8.*",
Expand Down
2,378 changes: 1,952 additions & 426 deletions composer.lock

Large diffs are not rendered by default.

30 changes: 21 additions & 9 deletions htdocs/web_portal/controllers/user/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,35 @@ function draw() {
die();
}

//Extract users email from oidc claims
$authDetails = $_SERVER['OIDC_CLAIM_external_authn'];
$startPos = 3+strpos($authDetails, ":", (strpos($authDetails, "MAIL")));
$endPos = strpos($authDetails, "\"", 3+$startPos);
$length = $endPos-$startPos;
$userEmail = substr($authDetails, $startPos, $length);
$params = [];

//Extract users email from oidc claims
$params['email'] = '';
if (key_exists('OIDC_CLAIM_external_authn', $_SERVER)) {
$authDetails = $_SERVER['OIDC_CLAIM_external_authn'];
$startPos = 3+strpos($authDetails, ":", (strpos($authDetails, "MAIL")));
$endPos = strpos($authDetails, "\"", 3+$startPos);
$length = $endPos-$startPos;
$params['email'] = substr($authDetails, $startPos, $length);
}

getPolicyURLs($params);

/* @var $authToken \org\gocdb\security\authentication\IAuthentication */
$authToken = Get_User_AuthToken();
$params['authAttributes'] = $authToken->getDetails();

$params['given_name'] = $_SERVER['OIDC_CLAIM_given_name'];
$params['family_name'] = $_SERVER['OIDC_CLAIM_family_name'];
$params['email'] = $userEmail;
$params['given_name'] = '';
if (key_exists('OIDC_CLAIM_given_name', $_SERVER)) {
$params['given_name'] = $_SERVER['OIDC_CLAIM_given_name'];
}
$params['family_name'] = '';
if (key_exists('OIDC_CLAIM_family_name', $_SERVER)) {
$params['family_name'] = $_SERVER['OIDC_CLAIM_family_name'];
}

$params['idString'] = $idString;

show_view('user/register.php', $params);
}

Expand Down
4 changes: 2 additions & 2 deletions htdocs/web_portal/views/admin/view_service_types.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</tr>
<?php
$num = 2;
if(sizeof($numberOfServiceTypes > 0)) {
if($numberOfServiceTypes > 0) {
foreach($params['ServiceTypes'] as $serviceType) {
?>
<tr class="site_table_row_<?php echo $num ?>">
Expand All @@ -59,4 +59,4 @@
?>
</table>
</div>
</div>
</div>
8 changes: 4 additions & 4 deletions htdocs/web_portal/views/political_role/view_requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
</tr>
<?php
$num = 2;
if(sizeof($params['myRequests'] > 0)) {
foreach($params['myRequests'] as $request) {
if (is_array($params['myRequests']) && sizeof($params['myRequests']) > 0) {
foreach ($params['myRequests'] as $request) {
?>
<tr class="site_table_row_<?php echo $num ?>">
<td class="site_table" style="width: 50%">
Expand Down Expand Up @@ -144,8 +144,8 @@
</tr>
<?php
$num = 2;
if(sizeof($params['allRequests'] > 0)) {
foreach($params['allRequests'] as $request) {
if (is_array($params['allRequests']) && sizeof($params['allRequests']) > 0) {
foreach ($params['allRequests'] as $request) {
?>
<tr class="site_table_row_<?php echo $num ?>">
<td class="site_table">
Expand Down
4 changes: 2 additions & 2 deletions htdocs/web_portal/views/user/view_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</div>
</td>
</tr>-->
<?php if(sizeof($params['user']->getHomeSite()) != 0) { ?>
<?php if ($params['user']->getHomeSite() != null) { ?>
<tr class="site_table_row_2">
<td class="site_table">Home Site</td>
<td class="site_table">
Expand Down Expand Up @@ -346,4 +346,4 @@
margin-bottom: 0;
font-size: 12px;
}
</style>
</style>
12 changes: 6 additions & 6 deletions tests/doctrine/DoctrineCleanInsert1Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ public function testShowDoctrineReadFailiureUntilCommitted(){
$this->em->persist($site);
// After persist, Doctrine querying does not return our site until we flush, hence we get 0
// returned from our repository.
$this->assertEquals(0, count($this->em->getRepository('Site')->findOneBy(array('shortName' => 'site' . $n))));
$this->assertEquals(0, count($this->em->getRepository('Site')->findBy(array('shortName' => 'site' . $n))));
// When we flush or commit we get one.
$this->em->commit();
$this->em->flush();
$this->assertEquals(1, count($this->em->getRepository('Site')->findOneBy(array('shortName' => 'site' . $n))));
$this->assertEquals(1, count($this->em->getRepository('Site')->findBy(array('shortName' => 'site' . $n))));
}


Expand Down Expand Up @@ -464,7 +464,7 @@ public function testRollback() {
* first have to delete the services that holds the FK to the site (one site
* to many services).
*
* @expectedException \Doctrine\DBAL\DBALException
* @expectedException \Doctrine\DBAL\Exception
*/
public function testExpectedFK_ViolationOnSiteDeleteWithoutCascade(){
print __METHOD__ . "\n";
Expand Down Expand Up @@ -496,7 +496,7 @@ public function testExpectedFK_ViolationOnSiteDeleteWithoutCascade(){
// services first as we have no cascade-delete option set.
$this->em->remove($refetchedSite);
$this->em->flush();
$this->fail('Should not get to this point - DBALException expected');
$this->fail('Should not get to this point - \Doctrine\DBAL\Exception expected');

}

Expand Down Expand Up @@ -659,7 +659,7 @@ public function testServiceToEndpointCascadeDelete_WithNoDTs(){
* association to a downtime (this relationship would need to be deleted first
* to allow the endpoint to be deleted cleanly by the cascade).
*
* @expectedException \Doctrine\DBAL\DBALException
* @expectedException \Doctrine\DBAL\Exception
*/
public function testExpectedFK_ViolationOnServiceToEndpointCascadeDelete_WithDTs(){
print __METHOD__ . "\n";
Expand Down Expand Up @@ -707,7 +707,7 @@ public function testExpectedFK_ViolationOnServiceToEndpointCascadeDelete_WithDTs
// services first as we have no cascade-delete option set.
$this->em->remove($se);
$this->em->flush();
$this->fail('Should not get to this point - DBALException expected');
$this->fail('Should not get to this point - \Doctrine\DBAL\Exception expected');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/doctrine/RolesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function testRoleDiscriminatorNGI() {
* Add a role type, user, NGI and a role linking
* them all together. Assert that $newRole->getOwnedEntity()
* returns an instance of NGI.
* @expectedException \Doctrine\DBAL\DBALException
* @expectedException \Doctrine\DBAL\Exception
*/
public function testRoleTypeIntegrityConstraint() {
print __METHOD__ . "\n";
Expand Down Expand Up @@ -226,7 +226,7 @@ public function testRoleTypeIntegrityConstraint() {

/**
* Ensure no duplicate role types are inserted
* @expectedException \Doctrine\DBAL\DBALException
* @expectedException \Doctrine\DBAL\Exception
*/
public function testDuplicateRoleTypes() {
print __METHOD__ . "\n";
Expand Down
24 changes: 12 additions & 12 deletions tests/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author David Meredith <[email protected]>
*
* @author David Meredith <[email protected]>
*/-->

<!--
PHPUnit configuration file for tests.
<!--
PHPUnit configuration file for tests.
-->
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down Expand Up @@ -43,7 +43,7 @@ PHPUnit configuration file for tests.
<!--printerFile="/path/to/ResultPrinter.php"-->
<!--testSuiteLoaderFile="/path/to/StandardTestSuiteLoader.php"-->
<!--bootstrap="/path/to/bootstrap.php" -->

<filter>
<!--<blacklist>
<directory suffix=".php">/path/to/files</directory>
Expand All @@ -53,12 +53,12 @@ PHPUnit configuration file for tests.
<file>/path/to/file</file>
</exclude>
</blacklist>-->
<!--
Name the core packages to be included in coverage reports.

<!--
Name the core packages to be included in coverage reports.
It is not desirable to produce coverage for every package, it is not useful
to do so. We have to be selective on which tests to write for which packages.
-->
to do so. We have to be selective on which tests to write for which packages.
-->
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../lib/Doctrine/entities/</directory>
<directory suffix=".php">../lib/DAOs/</directory>
Expand All @@ -71,5 +71,5 @@ PHPUnit configuration file for tests.
</exclude>
</whitelist>
</filter>
</phpunit>

</phpunit>