Skip to content

Commit

Permalink
Fix hooks processing in cURL tests
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera committed Sep 11, 2023
1 parent 30afc43 commit dd91131
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Transport/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function request($url, $headers = [], $data = [], $options = []) {

$this->setup_handle($url, $headers, $data, $options);

$options['hooks']->dispatch('curl.before_send', array(&$this->handle));
$options['hooks']->dispatch('curl.before_send', [&$this->handle]);

$this->response_data = '';
$this->response_bytes = 0;
Expand Down
11 changes: 6 additions & 5 deletions tests/Transport/Curl/CurlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,22 @@ final class CurlTest extends BaseTestCase {
* @param array $other
* @return array
*/
protected function getOptions($other = array()) {
protected function getOptions($other = []) {
$options = parent::getOptions($other);

$this->curl_handle = null;

$hooks = new Hooks();
$hooks->register(
if (!array_key_exists('hooks', $options)) {
$options['hooks'] = new Hooks();
}

$options['hooks']->register(
'curl.before_request',
function ($handle) {
$this->curl_handle = $handle;
}
);

$options['hooks'] = $hooks;

return $options;
}

Expand Down

0 comments on commit dd91131

Please sign in to comment.