Open Journal Systems
3.3.0
AbstractVisitorTestCase.php
1
<?php
2
3
namespace
Guzzle\Tests\Service\Command\LocationVisitor\Request
;
4
5
use
Guzzle\Http\Message\EntityEnclosingRequest
;
6
use
Guzzle\Service\Description\Operation
;
7
use
Guzzle\Service\Description\Parameter
;
8
use
Guzzle\Service\Description\SchemaValidator
;
9
use
Guzzle\Service\Command\OperationCommand
;
10
use
Guzzle\Tests\Service\Mock\Command\MockCommand
;
11
use
Guzzle\Tests\Service\Mock\MockClient
;
12
13
abstract
class
AbstractVisitorTestCase
extends
\Guzzle\Tests\GuzzleTestCase
14
{
15
protected
$command
;
16
protected
$request
;
17
protected
$param
;
18
protected
$validator
;
19
20
public
function
setUp
()
21
{
22
$this->command =
new
MockCommand
();
23
$this->request =
new
EntityEnclosingRequest
(
'POST'
,
'http://www.test.com/some/path.php'
);
24
$this->validator =
new
SchemaValidator
();
25
}
26
27
protected
function
getCommand
($location)
28
{
29
$command
=
new
OperationCommand
(array(), $this->
getNestedCommand
($location));
30
$command
->setClient(
new
MockClient
());
31
32
return
$command
;
33
}
34
35
protected
function
getNestedCommand
($location)
36
{
37
return
new
Operation
(array(
38
'httpMethod'
=>
'POST'
,
39
'parameters'
=> array(
40
'foo'
=>
new
Parameter
(array(
41
'type'
=>
'object'
,
42
'location'
=> $location,
43
'sentAs'
=>
'Foo'
,
44
'required'
=>
true
,
45
'properties'
=> array(
46
'test'
=> array(
47
'type'
=>
'object'
,
48
'required'
=>
true
,
49
'properties'
=> array(
50
'baz'
=> array(
51
'type'
=>
'boolean'
,
52
'default'
=>
true
53
),
54
'jenga'
=> array(
55
'type'
=>
'string'
,
56
'default'
=>
'hello'
,
57
'sentAs'
=>
'Jenga_Yall!'
,
58
'filters'
=> array(
'strtoupper'
)
59
)
60
)
61
),
62
'bar'
=> array(
'default'
=> 123)
63
),
64
'additionalProperties'
=> array(
65
'type'
=>
'string'
,
66
'filters'
=> array(
'strtoupper'
),
67
'location'
=> $location
68
)
69
)),
70
'arr'
=>
new
Parameter
(array(
71
'type'
=>
'array'
,
72
'location'
=> $location,
73
'items'
=> array(
74
'type'
=>
'string'
,
75
'filters'
=> array(
'strtoupper'
)
76
)
77
)),
78
)
79
));
80
}
81
82
protected
function
getCommandWithArrayParamAndFilters
()
83
{
84
$operation =
new
Operation
(array(
85
'httpMethod'
=>
'POST'
,
86
'parameters'
=> array(
87
'foo'
=>
new
Parameter
(array(
88
'type'
=>
'string'
,
89
'location'
=>
'query'
,
90
'sentAs'
=>
'Foo'
,
91
'required'
=>
true
,
92
'default'
=>
'bar'
,
93
'filters'
=> array(
'strtoupper'
)
94
)),
95
'arr'
=>
new
Parameter
(array(
96
'type'
=>
'array'
,
97
'location'
=>
'query'
,
98
'sentAs'
=>
'Arr'
,
99
'required'
=>
true
,
100
'default'
=> array(123, 456, 789),
101
'filters'
=> array(array(
'method'
=>
'implode'
,
'args'
=> array(
','
,
'@value'
)))
102
))
103
)
104
));
105
$command
=
new
OperationCommand
(array(), $operation);
106
$command
->setClient(
new
MockClient
());
107
108
return
$command
;
109
}
110
}
Guzzle\Tests\Service\Command\LocationVisitor\Request\AbstractVisitorTestCase\setUp
setUp()
Definition:
AbstractVisitorTestCase.php:20
Guzzle\Service\Description\Operation
Definition:
Operation.php:10
Guzzle\Tests\GuzzleTestCase
Definition:
GuzzleTestCase.php:22
Guzzle\Tests\Service\Mock\MockClient
Definition:
MockClient.php:11
Guzzle\Service\Description\Parameter
Definition:
Parameter.php:10
Guzzle\Service\Command\OperationCommand
Definition:
OperationCommand.php:10
Guzzle\Tests\Service\Command\LocationVisitor\Request
Definition:
AbstractVisitorTestCase.php:3
Guzzle\Tests\Service\Mock\Command\MockCommand
Definition:
MockCommand.php:7
Guzzle\Tests\Service\Command\LocationVisitor\Request\AbstractVisitorTestCase\$param
$param
Definition:
AbstractVisitorTestCase.php:17
Guzzle\Tests\Service\Command\LocationVisitor\Request\AbstractVisitorTestCase\getCommand
getCommand($location)
Definition:
AbstractVisitorTestCase.php:27
Guzzle\Http\Message\EntityEnclosingRequest
Definition:
EntityEnclosingRequest.php:14
Guzzle\Tests\Service\Command\LocationVisitor\Request\AbstractVisitorTestCase\getNestedCommand
getNestedCommand($location)
Definition:
AbstractVisitorTestCase.php:35
Guzzle\Tests\Service\Command\LocationVisitor\Request\AbstractVisitorTestCase\$command
$command
Definition:
AbstractVisitorTestCase.php:15
Guzzle\Tests\Service\Command\LocationVisitor\Request\AbstractVisitorTestCase
Definition:
AbstractVisitorTestCase.php:13
Guzzle\Service\Description\SchemaValidator
Definition:
SchemaValidator.php:10
Guzzle\Tests\Service\Command\LocationVisitor\Request\AbstractVisitorTestCase\$validator
$validator
Definition:
AbstractVisitorTestCase.php:18
Guzzle\Tests\Service\Command\LocationVisitor\Request\AbstractVisitorTestCase\$request
$request
Definition:
AbstractVisitorTestCase.php:16
Guzzle\Tests\Service\Command\LocationVisitor\Request\AbstractVisitorTestCase\getCommandWithArrayParamAndFilters
getCommandWithArrayParamAndFilters()
Definition:
AbstractVisitorTestCase.php:82
plugins
paymethod
paypal
lib
vendor
guzzle
guzzle
tests
Guzzle
Tests
Service
Command
LocationVisitor
Request
AbstractVisitorTestCase.php
Generated on Fri Aug 28 2020 14:50:33 for Open Journal Systems by
1.8.17