Browse Source

Fixed coding standards issues.

pull/396/head
Christian Selig 11 years ago
parent
commit
86d85e96d2
  1. 41
      islandora.module
  2. 51
      tests/islandora_tuque.test

41
islandora.module

@ -998,36 +998,6 @@ function islandora_get_tuque_connection($new_user = NULL, $url = NULL) {
global $user;
// $user_for_tuque = NULL;
//
// if TUQUE DOES NOT EXIST {
// if PROVIDED USER IS NOT NULL {
// MAKE TUQUE WITH PROVIDED USER
// }
// else
// {
// MAKE TUQUE WITH GLOBAL USER
// }
// }
// else {
// if PROVIDED USER IS NOT NULL {
// if PROVIDED USER IS NOT TUQUE'S USER {
// MAKE TUQUE WITH PROVIDED USER
// }
// else {
// LEAVE TUQUE ALONE
// }
// }
// else {
// if GLOBAL USER IS NOT TUQUE'S USER {
// MAKE TUQUE WITH GLOBAL USER
// }
// else {
// LEAVE TUQUE ALONE
// }
// }
// }
// If tuque is NULL.
if (!$tuque) {
// If the provided user is not null, pass it along to Tuque.
@ -1067,6 +1037,17 @@ function islandora_get_tuque_connection($new_user = NULL, $url = NULL) {
return $tuque;
}
/**
* Creates a singleton of tuque.
*
* @param object $user
* The user to create tuque with.
* @param string $url
* The URL to create tuque with.
*
* @return IslandoraTuque
* The singleton tuque object.
*/
function islandora_make_tuque($user, $url) {
if (IslandoraTuque::exists()) {
try {

51
tests/islandora_tuque.test

@ -58,10 +58,10 @@ class IslandoraTuqueTestCase extends IslandoraWebTestCase {
}
/**
/**
* Tests that tuque does not exist and the user is not null.
*/
public function testTuqueDoesNotExistAndUserIsNotNull() {
public function testTuqueDoesNotExistAndUserIsNotNull() {
$tuque = &drupal_static(__FUNCTION__);
$tuque = NULL;
@ -73,12 +73,12 @@ class IslandoraTuqueTestCase extends IslandoraWebTestCase {
assertNotNull($new_tuque);
assertNotNull($tuque);
assertEqual($user_to_provide->name, $new_tuque_user_name);
}
}
/**
/**
* Tests that tuque does not exist and the user is null.
*/
public function testTuqueDoesNotExistAndUserIsNull() {
public function testTuqueDoesNotExistAndUserIsNull() {
$tuque = &drupal_static(__FUNCTION__);
$tuque = NULL;
@ -92,13 +92,12 @@ class IslandoraTuqueTestCase extends IslandoraWebTestCase {
assertNotNull($new_tuque);
assertNotNull($tuque);
assertEqual($new_tuque_user_name, $user);
}
}
/**
* Test that tuque exists and the user is not null and the user is not tuque's
* user.
/**
* Test that tuque exists, the user is not null, the user is not tuque's user.
*/
public function testTuqueExistsAndUserIsNotNullAndUserIsNotTuquesUser() {
public function testTuqueExistsAndUserIsNotNullAndUserIsNotTuquesUser() {
$tuque = &drupal_static(__FUNCTION__);
$user_to_provide = user_load(0);
$new_tuque = islandora_get_tuque_connection($user_to_provide);
@ -106,25 +105,24 @@ class IslandoraTuqueTestCase extends IslandoraWebTestCase {
assertNotNull($new_tuque);
assertNotNull($tuque);
assertNotEqual($user_to_provide->name, $new_tuque->connection->username);
}
}
/**
* Tests that tuque exists and the user is not null and the user is tuque's user
/**
* Tests that tuque exists, the user is not null, the user is tuque's user.
*/
public function testTuqueExistsAndUserIsNotNullAndUserIsTuquesUser() {
public function testTuqueExistsAndUserIsNotNullAndUserIsTuquesUser() {
$tuque = &drupal_static(__FUNCTION__);
$new_tuque = islandora_get_tuque_connection($tuque->connection->username);
assertNotNull($new_tuque);
assertNotNull($tuque);
assertEqual($tuque->connection->username, $new_tuque->connection->username);
}
}
/**
* Tests that tuque exists and the user is null and the global user is not
* tuque's user.
/**
* Tests that tuque exists, the user is null, global user is not tuque's user.
*/
public function testTuqueExistsAndUserIsNullAndGlobalUserIsNotTuquesUser() {
public function testTuqueExistsAndUserIsNullAndGlobalUserIsNotTuquesUser() {
$tuque = &drupal_static(__FUNCTION__);
global $user = NULL;
$new_tuque = islandora_get_tuque_connection($user);
@ -132,19 +130,18 @@ class IslandoraTuqueTestCase extends IslandoraWebTestCase {
assertNotNull($new_tuque);
assertNotNull($tuque);
assertNotEqual($new_tuque->connection->username, $user);
}
}
/**
* Tests that tuque exists and the user is null and the global user is tuque's
* user.
/**
* Tests that tuque exists, the user is null, global user is tuque's user.
*/
public function testTuqueExistsAndUserIsNullAndGlobalUserIsTuquesUser() {
public function testTuqueExistsAndUserIsNullAndGlobalUserIsTuquesUser() {
$tuque = &drupal_static(__FUNCTION__);
global $user = $tuque->connection->username;
global $_islandora_user;
$_islandora_user = $tuque->connection->username;
$new_tuque = islandora_get_tuque_connection($user);
assertNotNull($new_tuque);
assertNotNull($tuque);
assertEqual($new_tuque->connection->username, $user);
}
}

Loading…
Cancel
Save