# |
Jul 16th 2021, 19:06 |
slackebot2 |
$this->request->getQueryParams('params'); $this->loadModel('Users'); $userAdmin = $this->Users->get(1); MercadoPago\SDK::setAccessToken($userAdmin->mp_access_token); $payment1 = MercadoPago\Payment::find_by_id($mpUrlNotif['id']); debug($payment1); exit; }``` this code is sending a 201 response and is showing the debug too |
# |
Jul 16th 2021, 19:06 |
sebastiansperandio093 |
I achieved to send a 201 response to the API which is notifying me and after of that response, I can continuw with my work inside the same method... ```public function mpNotification() { $this->response = $this->response->withStatus(201); $this->response->send(); $this->autoRender = false; $mpUrlNotif = |
# |
Jul 16th 2021, 19:03 |
sebastiansperandio093 |
fixed |
# |
Jul 16th 2021, 18:59 |
tyler.adam.lazenby |
it just timed out |
# |
Jul 16th 2021, 18:59 |
kevin.pfeifer |
what, that phpunit doesn't fail even if there are error? |
# |
Jul 16th 2021, 18:56 |
tyler.adam.lazenby |
is that normal |
# |
Jul 16th 2021, 18:56 |
tyler.adam.lazenby |
hmmmm but the command is still running |
# |
Jul 16th 2021, 18:56 |
tyler.adam.lazenby |
now I see |
# |
Jul 16th 2021, 18:56 |
tyler.adam.lazenby |
oh ok |
# |
Jul 16th 2021, 18:54 |
tyler.adam.lazenby |
what the heck is that mess |
# |
Jul 16th 2021, 18:54 |
kevin.pfeifer |
well ,:) |
# |
Jul 16th 2021, 18:53 |
tyler.adam.lazenby |
```C:\xampp\htdocs\ezBusinessManager>composer run test > phpunit --colors=always PHPUnit 9.5.6 by Sebastian Bergmann and contributors. Runtime: PHP 8.0.3 Configuration: C:\xampp\htdocs\ezBusinessManager\phpunit.xml EREIIIE### hello world ### RRRRRRRRRRRRRRRIIEEEEEEIIIIIIIIIIIIIIIIIIIIIIIIIEEEEEWEE 63 / 421 ( 14%) EEERRRRRRRRRRRRRRREEEEREEEWWWWWWWE``` |
# |
Jul 16th 2021, 18:53 |
tyler.adam.lazenby |
what the... |
# |
Jul 16th 2021, 18:51 |
tyler.adam.lazenby |
I am doing this more to make sure that the unit tests are forced into our pipeline since more developers will be coming down |
# |
Jul 16th 2021, 18:50 |
tyler.adam.lazenby |
Yes and no |
# |
Jul 16th 2021, 18:45 |
kevin.pfeifer |
seems like we both miss-understood the 201 location definition https://stackoverflow.com/questions/4584728/redirecting-with-a-201-created |
# |
Jul 16th 2021, 18:38 |
sebastiansperandio093 |
thanks for answered |
# |
Jul 16th 2021, 18:37 |
kevin.pfeifer |
but your phpunit tests work without it being executed by the gitlab CLI tool? |
# |
Jul 16th 2021, 18:37 |
tyler.adam.lazenby |
I am just trying to create a gitlab CI that will run the unit tests, and run the phpstan script |
# |
Jul 16th 2021, 18:36 |
kevin.pfeifer |
oh sorry, 201 should actually do that, didn't know that |
# |
Jul 16th 2021, 18:35 |
kevin.pfeifer |
@sebastiansperandio093 a 201 is not a HTTP repsonse which redirects automatically If you just update the location header the Browser wont just go to that location as far as I know You will have to implement some JS logic which checks that location header and then redirects to that |
# |
Jul 16th 2021, 18:34 |
kevin.pfeifer |
what "pipelines" are you running here? |
# |
Jul 16th 2021, 18:32 |
tyler.adam.lazenby |
I had to run the configuration generator first |
# |
Jul 16th 2021, 18:28 |
tyler.adam.lazenby |
I am wondering if I need to alter it to allow stack tracing |
# |
Jul 16th 2021, 18:28 |
tyler.adam.lazenby |
I literally looked at my code and line 98 is just exception thrower |
# |
Jul 16th 2021, 18:27 |
tyler.adam.lazenby |
I know! that is why I am so confused |
# |
Jul 16th 2021, 18:21 |
sebastiansperandio093 |
is it possible? What I am wrong? |
# |
Jul 16th 2021, 18:20 |
slackebot2 |
debug($mpUrlNotif);exit; }``` I can see the response with status 201 and the location updated, but it is not redirecting to notification-handler method |
# |
Jul 16th 2021, 18:20 |
slackebot2 |
$this->request->getQueryParams('params'); $locationRedirect = 'http://localhost:5005/mp-payments/notification-handler?topic='.$mpUrlNotif['topic'].'andid='.$mpUrlNotif['id']; $this->response = $this->response->withStatus(201); $response = $this->response->withHeader('Location', $locationRedirect ); return $response; } public function notificationHandler() { $mpUrlNotif = $this->request->getQueryParams('params'); |
# |
Jul 16th 2021, 18:20 |
sebastiansperandio093 |
hello everyone!! Can someone help me with this simple issue: This is the URL where an API that I'm using is trying send notifications: http://localhost:5005/mp-payments/mp_notifications?topic=paymentandid=1238697171 I'm triying to create a response 201 and after redirect to another method of a controller class using location header: ```public function mpNotifications() { $mpUrlNotif = |
# |
Jul 16th 2021, 18:17 |
kevin.pfeifer |
there is no - at that line here https://github.com/sebastianbergmann/phpunit/blob/9.5/src/TextUI/Command.php#L98 |
# |
Jul 16th 2021, 18:16 |
tyler.adam.lazenby |
`"phpunit/phpunit": "^9.0",` |
# |
Jul 16th 2021, 18:15 |
tyler.adam.lazenby |
I am on phpunit 9.5.6 |
# |
Jul 16th 2021, 18:15 |
kevin.pfeifer |
and which php version are you running it with? |
# |
Jul 16th 2021, 18:15 |
kevin.pfeifer |
PHPUnit 8.5 i guess |
# |
Jul 16th 2021, 18:14 |
tyler.adam.lazenby |
C:\xampp\htdocs\ezBusinessManager>composer run test > phpunit --colors=always Exception: syntax error, unexpected token "-", expecting "{" In [C:\xampp\htdocs\ezBusinessManager\vendor\phpunit\phpunit\src\TextUI\Command.php, line 98] Script phpunit --colors=always handling the test event returned with error code 1 |
# |
Jul 16th 2021, 18:04 |
tyler.adam.lazenby |
C:\composer\composer.bat run-script test > phpunit --colors=always [31mException:[0m syntax error, unexpected token "-", expecting "{" In [C:\xampp\htdocs\ezBusinessManager\vendor\phpunit\phpunit\src\TextUI\Command.php, line 98] Script phpunit --colors=always handling the test event returned with error code 1 |
# |
Jul 16th 2021, 18:04 |
tyler.adam.lazenby |
I am not sure what tis is |
# |
Jul 16th 2021, 18:04 |
tyler.adam.lazenby |
> phpunit --colors=always [31mException:[0m syntax error, unexpected token "-", expecting "{" |
# |
Jul 16th 2021, 18:04 |
tyler.adam.lazenby |
I am trying to get my pipeline working but I am running into an issue with phpunit |
# |
Jul 16th 2021, 11:14 |
paolo.bragagni |
i have to close 4 brackets of problems |