Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
Fixes #30415
  • Loading branch information
vboctor committed Apr 28, 2023
1 parent 5caafd2 commit 99f61e9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
11 changes: 3 additions & 8 deletions api/soap/mc_project_api.php
Expand Up @@ -466,14 +466,14 @@ function mc_project_version_add( $p_username, $p_password, stdClass $p_version )
'description' => $p_version['description'],
'released' => $p_version['released'],
'obsolete' => isset( $p_version['obsolete'] ) ? $p_version['obsolete'] : false,
'timestamp' => $p_version['date_order'],
'timestamp' => $p_version['date_order']
)
);

$t_command = new VersionAddCommand( $t_data );
$t_result = $t_command->execute();

return $t_result['id'];
return $t_result['version']['id'];
}

/**
Expand All @@ -486,8 +486,6 @@ function mc_project_version_add( $p_username, $p_password, stdClass $p_version )
* @return boolean returns true or false depending on the success of the update action
*/
function mc_project_version_update( $p_username, $p_password, $p_version_id, stdClass $p_version ) {
global $g_project_override;

$t_user_id = mci_check_login( $p_username, $p_password );

if( $t_user_id === false ) {
Expand All @@ -505,11 +503,10 @@ function mc_project_version_update( $p_username, $p_password, $p_version_id, std
$p_version = ApiObjectFactory::objectToArray( $p_version );

$t_project_id = $p_version['project_id'];
$g_project_override = $t_project_id;
$t_name = $p_version['name'];
$t_released = $p_version['released'];
$t_description = $p_version['description'];
$t_date_order = isset( $p_version['date_order'] ) ? strtotime( $p_version['date_order'] ) : null;
$t_date_order = is_blank( $p_version['date_order'] ) ? null : $p_version['date_order'];
$t_obsolete = isset( $p_version['obsolete'] ) ? $p_version['obsolete'] : false;

if( is_blank( $t_project_id ) ) {
Expand Down Expand Up @@ -553,8 +550,6 @@ function mc_project_version_update( $p_username, $p_password, $p_version_id, std
* @return boolean returns true or false depending on the success of the delete action
*/
function mc_project_version_delete( $p_username, $p_password, $p_version_id ) {
global $g_project_override;

$t_user_id = mci_check_login( $p_username, $p_password );

if( $t_user_id === false ) {
Expand Down
2 changes: 1 addition & 1 deletion core/commands/VersionDeleteCommand.php
Expand Up @@ -110,7 +110,7 @@ protected function process() {
# The remove API triggers the EVENT_VERSION_DELETE event
# will leave it there so that it is triggered when a project
# is deleted, and it deletes all versions.
version_remove( $this->version_id, null );
version_remove( $this->version_id, '' );

$g_project_override = $t_prev_project_id;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/rest/AllTests.php
Expand Up @@ -27,6 +27,7 @@
* Test config
*/
require_once __DIR__ . '/RestIssueTests.php';
require_once __DIR__ . '/RestProjectVersionTests.php';
require_once __DIR__ . '/RestUserTests.php';

/**
Expand All @@ -53,6 +54,7 @@ public static function suite() {
$t_suite = new RestAllTests( 'REST API' );

$t_suite->addTestSuite( 'RestIssueTests' );
$t_suite->addTestSuite( 'RestProjectVersionTests' );
$t_suite->addTestSuite( 'RestUserTests' );

return $t_suite;
Expand Down
1 change: 0 additions & 1 deletion tests/rest/RestProjectVersionTests.php
Expand Up @@ -28,7 +28,6 @@
/**
* Test fixture for project related APIs.
*
* @requires extension curl
* @group REST
*/
class RestProjectVersionTests extends RestBase {
Expand Down
2 changes: 1 addition & 1 deletion tests/soap/VersionTest.php
Expand Up @@ -59,7 +59,7 @@ private function getTestVersion() {
'released' => true,
'description' => 'Test version',
'obsolete' => false,
'date_order'=> $this->date_order,
'date_order' => $this->date_order
);
}

Expand Down

0 comments on commit 99f61e9

Please sign in to comment.