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

[api/test] raisinbread/test/api/LorisApiInstrumentsTest.php test not working incorrect #8781

Closed
driusan opened this issue Jun 14, 2023 · 1 comment
Labels
Area: API PR or issue related to the API Category: Bug PR or issue that aims to report or fix a bug

Comments

@driusan
Copy link
Collaborator

driusan commented Jun 14, 2023

When attempting to test the difference between v0.0.3 and v0.0.4 of the API in testGetCandidatesCandidVisitInstrumentsInstrument I discovered that the test is not correct. It is testing that the response is a 200 and the body is not empty. However, getBody() is the object, so will always not be empty. It likely meant to test getBody()->getContents() not being empty. However, this would still pass incorrectly.

The test is then calling json_decode on the body but not doing anything with the decoded value. The decode, in fact, fails, because the non-empty body being returned is:

<br />
<b>Warning</b>:  Undefined array key "CommentID" in <b>/app/modules/api/php/views/visit/instrument_0_0_4_dev.class.inc</b> on line <b>55</b><br />
<br />
<b>Fatal error</b>:  Uncaught TypeError: strpos(): Argument #1 ($haystack) must be of type string, null given in /app/modules/api/php/views/visit/instrument_0_0_4_dev.class.inc:55
Stack trace:
#0 /app/modules/api/php/views/visit/instrument_0_0_4_dev.class.inc(55): strpos(NULL, 'DDE_')
#1 /app/modules/api/php/endpoints/candidate/visit/instrument/instrument.class.inc(156): LORIS\api\Views\Visit\Instrument_0_0_4_Dev-&gt;toArray()
#2 /app/modules/api/php/endpoints/candidate/visit/instrument/instrument.class.inc(115): LORIS\api\Endpoints\Candidate\Visit\Instrument\Instrument-&gt;_handleGET(Object(Laminas\Diactoros\ServerRequest))
#3 /app/src/Middleware/ETag.php(78): LORIS\api\Endpoints\Candidate\Visit\Instrument\Instrument-&gt;handle(Object(Laminas\Diactoros\ServerRequest))
#4 /app/src/Http/Endpoint.php(51): LORIS\Middleware\ETag-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Visit\Instrument\Instrument))
#5 /app/modules/api/php/endpoint.class.inc(65): LORIS\Http\Endpoint-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Visit\Instrument\Instrument))
#6 /app/modules/api/php/endpoints/candidate/visit/instruments.class.inc(146): LORIS\Api\Endpoint-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Visit\Instrument\Instrument))
#7 /app/src/Middleware/ETag.php(78): LORIS\api\Endpoints\Candidate\Visit\Instruments-&gt;handle(Object(Laminas\Diactoros\ServerRequest))
#8 /app/src/Http/Endpoint.php(51): LORIS\Middleware\ETag-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Visit\Instruments))
#9 /app/modules/api/php/endpoint.class.inc(65): LORIS\Http\Endpoint-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Visit\Instruments))
#10 /app/modules/api/php/endpoints/candidate/visit/visit_0_0_4_dev.class.inc(166): LORIS\Api\Endpoint-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Visit\Instruments))
#11 /app/src/Middleware/ETag.php(78): LORIS\api\Endpoints\Candidate\Visit\Visit_0_0_4_Dev-&gt;handle(Object(Laminas\Diactoros\ServerRequest))
#12 /app/src/Http/Endpoint.php(51): LORIS\Middleware\ETag-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Visit\Visit_0_0_4_Dev))
#13 /app/modules/api/php/endpoint.class.inc(65): LORIS\Http\Endpoint-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Visit\Visit_0_0_4_Dev))
#14 /app/modules/api/php/endpoints/candidate/candidate.class.inc(128): LORIS\Api\Endpoint-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Visit\Visit_0_0_4_Dev))
#15 /app/src/Middleware/ETag.php(78): LORIS\api\Endpoints\Candidate\Candidate-&gt;handle(Object(Laminas\Diactoros\ServerRequest))
#16 /app/src/Http/Endpoint.php(51): LORIS\Middleware\ETag-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Candidate))
#17 /app/modules/api/php/endpoint.class.inc(65): LORIS\Http\Endpoint-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Candidate))
#18 /app/modules/api/php/endpoints/candidates.class.inc(162): LORIS\Api\Endpoint-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidate\Candidate))
#19 /app/src/Middleware/ETag.php(78): LORIS\api\Endpoints\Candidates-&gt;handle(Object(Laminas\Diactoros\ServerRequest))
#20 /app/src/Http/Endpoint.php(51): LORIS\Middleware\ETag-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidates))
#21 /app/modules/api/php/endpoint.class.inc(65): LORIS\Http\Endpoint-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidates))
#22 /app/modules/api/php/module.class.inc(123): LORIS\Api\Endpoint-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\api\Endpoints\Candidates))
#23 /app/src/Router/ModuleRouter.php(77): LORIS\api\Module-&gt;handle(Object(Laminas\Diactoros\ServerRequest))
#24 /app/src/Middleware/ExceptionHandlingMiddleware.php(54): LORIS\Router\ModuleRouter-&gt;handle(Object(Laminas\Diactoros\ServerRequest))
#25 /app/src/Router/BaseRouter.php(132): LORIS\Middleware\ExceptionHandlingMiddleware-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\Router\ModuleRouter))
#26 /app/src/Middleware/ResponseGenerator.php(50): LORIS\Router\BaseRouter-&gt;handle(Object(Laminas\Diactoros\ServerRequest))
#27 /app/src/Middleware/ContentLength.php(52): LORIS\Middleware\ResponseGenerator-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\Router\BaseRouter))
#28 /app/htdocs/index.php(55): LORIS\Middleware\ContentLength-&gt;process(Object(Laminas\Diactoros\ServerRequest), Object(LORIS\Router\BaseRouter))
#29 /app/htdocs/router.php(45): include_once('/app/htdocs/ind...')
#30 {main}
  thrown in <b>/app/modules/api/php/views/visit/instrument_0_0_4_dev.class.inc</b> on line <b>55</b><br />
@driusan driusan added Category: Bug PR or issue that aims to report or fix a bug Area: API PR or issue related to the API labels Jun 14, 2023
driusan added a commit to driusan/Loris that referenced this issue Jun 21, 2023
The previous test was "incomplete" (it got the data but didn't
do anything to verify it.) This adds real tests for the candidate
instrument data endpoint now that Issue aces#8781 was fixed by PR#8796.
driusan added a commit to driusan/Loris that referenced this issue Jun 21, 2023
The previous test was "incomplete" (it got the data but didn't
do anything to verify it.) This adds real tests for the candidate
instrument data endpoint now that Issue aces#8781 was fixed by PR#8796.
driusan added a commit to driusan/Loris that referenced this issue Jun 21, 2023
The previous test was "incomplete" (it got the data but didn't
do anything to verify it.) This adds real tests for the candidate
instrument data endpoint now that Issue aces#8781 was fixed by PR#8796.
driusan added a commit to driusan/Loris that referenced this issue Jun 21, 2023
The previous test was "incomplete" (it got the data but didn't
do anything to verify it.) This adds real tests for the candidate
instrument data endpoint now that Issue aces#8781 was fixed by PR#8796.
driusan added a commit to driusan/Loris that referenced this issue Jun 21, 2023
The previous test was "incomplete" (it got the data but didn't
do anything to verify it.) This adds real tests for the candidate
instrument data endpoint now that Issue aces#8781 was fixed by PR#8796.
driusan added a commit to driusan/Loris that referenced this issue Jun 21, 2023
The previous test was "incomplete" (it got the data but didn't
do anything to verify it.) This adds real tests for the candidate
instrument data endpoint now that Issue aces#8781 was fixed by PR#8796.
driusan added a commit to driusan/Loris that referenced this issue Jun 21, 2023
The previous test was "incomplete" (it got the data but didn't
do anything to verify it.) This adds real tests for the candidate
instrument data endpoint now that Issue aces#8781 was fixed by PR#8796.
driusan added a commit to driusan/Loris that referenced this issue Jun 21, 2023
The previous test was "incomplete" (it got the data but didn't
do anything to verify it.) This adds real tests for the candidate
instrument data endpoint now that Issue aces#8781 was fixed by PR#8796.
driusan added a commit to driusan/Loris that referenced this issue Jun 21, 2023
The previous test was "incomplete" (it got the data but didn't
do anything to verify it.) This adds real tests for the candidate
instrument data endpoint now that Issue aces#8781 was fixed by PR#8796.
driusan added a commit that referenced this issue Jul 4, 2023
The previous test was "incomplete" (it got the data but didn't
do anything to verify it.) This adds real tests for the candidate
instrument data endpoint now that Issue #8781 was fixed by PR#8796.
@driusan
Copy link
Collaborator Author

driusan commented Sep 10, 2024

Seems to be fixed by above

@driusan driusan closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: API PR or issue related to the API Category: Bug PR or issue that aims to report or fix a bug
Projects
None yet
Development

No branches or pull requests

1 participant