php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #60478
Patch stream_context_set_option_error_002.phpt revision 2011-12-09 09:50 UTC by jm at jmfontaine dot net
Patch stream_context_set_option_error_001.phpt revision 2011-12-09 09:50 UTC by jm at jmfontaine dot net
Patch stream_context_set_option_basic.phpt revision 2011-12-09 09:50 UTC by jm at jmfontaine dot net
Patch spl_autoload_call_basic.phpt revision 2011-12-09 09:49 UTC by jm at jmfontaine dot net

Patch stream_context_set_option_basic.phpt for Testing related Bug #60478

Patch version 2011-12-09 09:50 UTC

Return to Bug #60478 | Download this patch
Patch Revisions:

Developer: jm@jmfontaine.net

--TEST--
stream_context_set_option() function - basic test for stream_context_set_option()
--CREDITS--
Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr>
# Alter Way Contribution Day 2011
--FILE--
<?php
$context = stream_context_create();

// Single option
var_dump(stream_context_set_option($context, 'http', 'method', 'POST'));

// Array of options
$options = array(
    'http' => array(
        'protocol_version' => 1.1,
        'user_agent'       => 'PHPT Agent',
    ),
);
var_dump(stream_context_set_option($context, $options));

var_dump(stream_context_get_options($context));
?>
--EXPECT--
bool(true)
bool(true)
array(1) {
  ["http"]=>
  array(3) {
    ["method"]=>
    string(4) "POST"
    ["protocol_version"]=>
    float(1.1)
    ["user_agent"]=>
    string(10) "PHPT Agent"
  }
}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC