Skip to content

Commit

Permalink
SOAP API: add failing test for retrieving issue text in non-latin cha…
Browse files Browse the repository at this point in the history
…rsets

Affects #14157: Array to string conversion error on soap request with
PHP 5.4
  • Loading branch information
rombert committed Nov 14, 2012
1 parent eac6b08 commit fbbf1d2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/soap/mc_issue_api.php
Expand Up @@ -80,7 +80,7 @@ function mc_issue_get( $p_username, $p_password, $p_issue_id ) {
$t_issue_data['status'] = mci_enum_get_array_by_id( $t_bug->status, 'status', $t_lang );

$t_issue_data['reporter'] = mci_account_get_array_by_id( $t_bug->reporter_id );
$t_issue_data['summary'] = $t_bug->summary;
$t_issue_data['summary'] = mci_sanitize_xml_string($t_bug->summary);
$t_issue_data['version'] = mci_null_if_empty( $t_bug->version );
$t_issue_data['build'] = mci_null_if_empty( $t_bug->build );
$t_issue_data['profile_id'] = mci_null_if_empty( $t_bug->profile_id );
Expand Down
27 changes: 27 additions & 0 deletions tests/soap/IssueAddTest.php
Expand Up @@ -543,4 +543,31 @@ public function testCreateIssueWithFieldsByName() {
$this->assertEquals( $issueToAdd['resolution']['name'], $issue->resolution->name);
$this->assertEquals( $issueToAdd['status']['name'], $issue->status->name);
}

/**
* A test cases that tests the creation of issues with non-latin text, to validate that
* it is not stripped.
*/
public function testCreateIssueWithNonLatinText() {
$issueToAdd = $this->getIssueToAdd( 'IssueAddTest.testCreateIssueWithNonLatinText' );

$issueToAdd['summary'] = "Здравствуйте!"; // Russian, hello
$issueToAdd['description'] = "你好";// Mandarin Chinese, hello

$issueId = $this->client->mc_issue_add(
$this->userName,
$this->password,
$issueToAdd);

$this->deleteAfterRun( $issueId );

$issue = $this->client->mc_issue_get(
$this->userName,
$this->password,
$issueId);

// explicitly specified fields
$this->assertEquals( $issueToAdd['summary'], $issue->summary , 'summary is not correct');
$this->assertEquals( $issueToAdd['description'], $issue->description , 'description is not correct');
}
}

0 comments on commit fbbf1d2

Please sign in to comment.