File: PsrHttpMessageServerRequestFactoryInterface.phpt

package info (click to toggle)
php-psr 1.2.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 548 kB
  • sloc: ansic: 1,485; pascal: 203; xml: 150; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 1,203 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--TEST--
Psr\Http\Message\ServerRequestFactoryInterface
--SKIPIF--
<?php include('skip.inc'); ?>
--FILE--
<?php
include __DIR__ . '/SampleMessage.inc';
include __DIR__ . '/SampleUri.inc';
include __DIR__ . '/SampleRequest.inc';
include __DIR__ . '/SampleServerRequest.inc';
include __DIR__ . '/SampleServerRequestFactory.inc';
var_dump(interface_exists('\\Psr\\Http\\Message\\ServerRequestFactoryInterface', false));
var_dump(class_implements('SampleServerRequestFactory', false));
$factory = new SampleServerRequestFactory();
$request = $factory->createServerRequest('GET', 'http://domain.com');
var_dump($request instanceof \Psr\Http\Message\ServerRequestInterface);
$request = $factory->createServerRequest('POST', new SampleUri(), ['param' => 'value']);
--EXPECTF--
bool(true)
array(1) {
  ["PsrExt\Http\Message\ServerRequestFactoryInterface"]=>
  string(49) "PsrExt\Http\Message\ServerRequestFactoryInterface"
}
string(47) "SampleServerRequestFactory::createServerRequest"
string(3) "GET"
string(17) "http://domain.com"
array(0) {
}
bool(true)
string(47) "SampleServerRequestFactory::createServerRequest"
string(4) "POST"
object(SampleUri)#%d (0) {
}
array(1) {
  ["param"]=>
  string(5) "value"
}