View Issue Details

IDProjectCategoryView StatusLast Update
0015817mantisbtapi soappublic2014-02-07 18:24
Reportervboctor Assigned Todregad  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.2.15 
Target Version1.2.16Fixed in Version1.2.16 
Summary0015817: SOAP API unit test failures
Description

Got the following errors when running the unit tests.
https://gist.github.com/vboctor/0ae5d68ec3593f3c89e2

TagsNo tags attached.

Relationships

related to 0016485 closeddregad SOAP API test failure for due date 

Activities

dregad

dregad

2013-05-07 10:06

developer   ~0036799

See discussion thread [1]

I can consistently reproduce the issue with dates (in VersionTest.php), using both php5_soap and nusoap, and I believe it's clearly a case of not taking the timezone into consideration (due to comparing a string instead of a datetime object).

The case of AttachmentTest is a bit weird though. I tested with different setups and PHP versions (but always with same Mantis code) and in most cases, the attachment's download_url as returned by mc_issue_get() has an encoded '&', but in one case [2] it returned '&' (regardless of which soap was used), and I have no idea why.

So IMO a good way to fix this would be to use html_entity_decode() on the download_url returned by soap api.

[1] http://thread.gmane.org/gmane.comp.bug-tracking.mantis.devel/4412
[2] PHP 5.2.14 with Suhosin-Patch 0.9.7 on Apache/2.2.10 (Linux/SUSE)

dregad

dregad

2013-05-07 10:31

developer   ~0036800

Test this: https://github.com/dregad/mantisbt/tree/fix-15817

dregad

dregad

2013-06-03 04:38

developer   ~0037037

Reminder sent to: rombert

rombert, could you kindly have a look at my patch and let me know if it's OK for you ?

rombert

rombert

2013-06-03 10:58

reporter   ~0037042

All three commits look good to me. BTW, what did you use to format the code?

dregad

dregad

2013-06-03 18:26

developer   ~0037054

Thx for feedback.

what did you use to format the code?

What do you mean?

rombert

rombert

2013-06-04 03:16

reporter   ~0037066

Last edited: 2013-06-04 03:16

Did you reformat the code manually? https://github.com/dregad/mantisbt/commit/4517dd1a6a54a1294ca71235aa81aef26cae925d introduces whitespace changes and I'm curious if you did them manually or with an IDE.

dregad

dregad

2013-06-04 07:17

developer   ~0037079

My text editor (geany) is configured to automatically remove trailing whitespace, and to use tabs for indents as per our coding guidelines.

Using the tab key indents/outdents a text block, and this function replaces spaces by tabs if needed. There's also a function to replace spaces by tabs and vice-versa.

I also have git configured to highlight whitespace errors (trailing-space, space-before-tab, indent-with-non-tab) so I easily spot issues when I diff changes; I have also been playing with a pre-commit hook to validate such things.

So in short, it's a mix of manual and automated.

Related Changesets

MantisBT: master 4465b2f1

2013-05-06 01:07

Damien Regad

Committer: dregad


Details Diff
soap/VersionTest.php: take timezone into consideration

Prior to this, dates were compared as string, resulting in
'2015-10-29T12:59:14+00:00' and '2015-10-29T05:59:14-07:00' to be
considered as different dates.

Fixes 0015817
Affected Issues
0015817
mod - tests/soap/VersionTest.php Diff File

MantisBT: master-1.2.x 220fcc43

2013-05-06 01:07

Damien Regad

Committer: dregad


Details Diff
soap/VersionTest.php: take timezone into consideration

Prior to this, dates were compared as string, resulting in
'2015-10-29T12:59:14+00:00' and '2015-10-29T05:59:14-07:00' to be
considered as different dates.

Fixes 0015817
Affected Issues
0015817
mod - tests/soap/VersionTest.php Diff File

MantisBT: master 9b3d9f76

2013-05-07 06:26

Damien Regad

Committer: dregad


Details Diff
soap/AttachmentTest.php: fix reference download URL

mc_issue_api.php/mci_issue_get_attachments() generates the download URL
with '&' while the test suite compares it with '&'. In some cases
the soap api returns '&' while in most cases it returns '&'.

To fix the problem we decode the string with html_entity_decode() before
comparing it.

Fixes 0015817
Affected Issues
0015817
mod - tests/soap/AttachmentTest.php Diff File

MantisBT: master-1.2.x 59ec39d5

2013-05-07 06:26

Damien Regad

Committer: dregad


Details Diff
soap/AttachmentTest.php: fix reference download URL

mc_issue_api.php/mci_issue_get_attachments() generates the download URL
with '&' while the test suite compares it with '&'. In some cases
the soap api returns '&' while in most cases it returns '&'.

To fix the problem we decode the string with html_entity_decode() before
comparing it.

Fixes 0015817
Affected Issues
0015817
mod - tests/soap/AttachmentTest.php Diff File

MantisBT: master c5c64f48

2013-10-14 03:37

dregad


Details Diff
Tests: Move dateToUTC() to SoapBase class

This helper function can be used everywhere we compare dates, not just
in VersionTest class.

Issues 0015817, 0016485
Affected Issues
0015817, 0016485
mod - tests/soap/SoapBase.php Diff File
mod - tests/soap/VersionTest.php Diff File

MantisBT: master-1.2.x 714ea0ec

2013-10-14 04:02

dregad


Details Diff
Tests: Move dateToUTC() to SoapBase class

This helper function can be used everywhere we compare dates, not just
in VersionTest class.

Issues 0015817, 0016485
Affected Issues
0015817, 0016485
mod - tests/soap/SoapBase.php Diff File
mod - tests/soap/VersionTest.php Diff File