@@ -41,25 +41,25 @@ public function testInvalidCloudEventRequestBody()
41
41
$ request = new ServerRequest ('POST ' , '/ ' , $ headers , 'notjson ' );
42
42
$ cloudEventFunctionWrapper = new CloudEventFunctionWrapper ([$ this , 'invokeThis ' ]);
43
43
$ response = $ cloudEventFunctionWrapper ->execute ($ request );
44
- $ this ->assertEquals (400 , $ response ->getStatusCode ());
45
- $ this ->assertEquals (
44
+ $ this ->assertSame (400 , $ response ->getStatusCode ());
45
+ $ this ->assertSame (
46
46
'Could not parse CloudEvent: Syntax error ' ,
47
47
(string ) $ response ->getBody ()
48
48
);
49
- $ this ->assertEquals ('crash ' , $ response ->getHeaderLine ('X-Google-Status ' ));
49
+ $ this ->assertSame ('crash ' , $ response ->getHeaderLine ('X-Google-Status ' ));
50
50
}
51
51
52
52
public function testInvalidLegacyEventRequestBody ()
53
53
{
54
54
$ request = new ServerRequest ('POST ' , '/ ' , [], 'notjson ' );
55
55
$ cloudEventFunctionWrapper = new CloudEventFunctionWrapper ([$ this , 'invokeThis ' ]);
56
56
$ response = $ cloudEventFunctionWrapper ->execute ($ request );
57
- $ this ->assertEquals (400 , $ response ->getStatusCode ());
58
- $ this ->assertEquals (
57
+ $ this ->assertSame (400 , $ response ->getStatusCode ());
58
+ $ this ->assertSame (
59
59
'Could not parse CloudEvent: Syntax error ' ,
60
60
(string ) $ response ->getBody ()
61
61
);
62
- $ this ->assertEquals ('crash ' , $ response ->getHeaderLine ('X-Google-Status ' ));
62
+ $ this ->assertSame ('crash ' , $ response ->getHeaderLine ('X-Google-Status ' ));
63
63
}
64
64
65
65
public function testNonJsonIsValidInBinaryCloudEventRequestBody ()
@@ -74,7 +74,7 @@ public function testNonJsonIsValidInBinaryCloudEventRequestBody()
74
74
[$ this , 'invokeThisPartial ' ]
75
75
);
76
76
$ response = $ cloudEventFunctionWrapper ->execute ($ request );
77
- $ this ->assertEquals (200 , $ response ->getStatusCode ());
77
+ $ this ->assertSame (200 , $ response ->getStatusCode ());
78
78
}
79
79
80
80
public function testInvalidJsonBinaryCloudEventRequestBody ()
@@ -90,12 +90,12 @@ public function testInvalidJsonBinaryCloudEventRequestBody()
90
90
[$ this , 'invokeThisPartial ' ]
91
91
);
92
92
$ response = $ cloudEventFunctionWrapper ->execute ($ request );
93
- $ this ->assertEquals (400 , $ response ->getStatusCode ());
94
- $ this ->assertEquals (
93
+ $ this ->assertSame (400 , $ response ->getStatusCode ());
94
+ $ this ->assertSame (
95
95
'Could not parse CloudEvent: Syntax error ' ,
96
96
(string ) $ response ->getBody ()
97
97
);
98
- $ this ->assertEquals ('crash ' , $ response ->getHeaderLine ('X-Google-Status ' ));
98
+ $ this ->assertSame ('crash ' , $ response ->getHeaderLine ('X-Google-Status ' ));
99
99
}
100
100
101
101
public function testValidJsonBinaryCloudEventRequestBody ()
@@ -111,7 +111,7 @@ public function testValidJsonBinaryCloudEventRequestBody()
111
111
[$ this , 'invokeThisPartial ' ]
112
112
);
113
113
$ response = $ cloudEventFunctionWrapper ->execute ($ request );
114
- $ this ->assertEquals (200 , $ response ->getStatusCode ());
114
+ $ this ->assertSame (200 , $ response ->getStatusCode ());
115
115
}
116
116
117
117
public function testNoFunctionParameters ()
@@ -232,14 +232,14 @@ public function invokeThis(CloudEvent $cloudevent)
232
232
{
233
233
$ this ->assertFalse (self ::$ functionCalled );
234
234
self ::$ functionCalled = true ;
235
- $ this ->assertEquals ('1413058901901494 ' , $ cloudevent ->getId ());
236
- $ this ->assertEquals ('//pubsub.googleapis.com/projects/MY-PROJECT/topics/MY-TOPIC ' , $ cloudevent ->getSource ());
237
- $ this ->assertEquals ('1.0 ' , $ cloudevent ->getSpecVersion ());
238
- $ this ->assertEquals ('com.google.cloud.pubsub.topic.publish ' , $ cloudevent ->getType ());
239
- $ this ->assertEquals ('application/json ' , $ cloudevent ->getDataContentType ());
240
- $ this ->assertEquals ('type.googleapis.com/google.logging.v2.LogEntry ' , $ cloudevent ->getDataSchema ());
241
- $ this ->assertEquals ('My Subject ' , $ cloudevent ->getSubject ());
242
- $ this ->assertEquals ('2020-12-08T20:03:19.162Z ' , $ cloudevent ->getTime ());
235
+ $ this ->assertSame ('1413058901901494 ' , $ cloudevent ->getId ());
236
+ $ this ->assertSame ('//pubsub.googleapis.com/projects/MY-PROJECT/topics/MY-TOPIC ' , $ cloudevent ->getSource ());
237
+ $ this ->assertSame ('1.0 ' , $ cloudevent ->getSpecVersion ());
238
+ $ this ->assertSame ('com.google.cloud.pubsub.topic.publish ' , $ cloudevent ->getType ());
239
+ $ this ->assertSame ('application/json ' , $ cloudevent ->getDataContentType ());
240
+ $ this ->assertSame ('type.googleapis.com/google.logging.v2.LogEntry ' , $ cloudevent ->getDataSchema ());
241
+ $ this ->assertSame ('My Subject ' , $ cloudevent ->getSubject ());
242
+ $ this ->assertSame ('2020-12-08T20:03:19.162Z ' , $ cloudevent ->getTime ());
243
243
}
244
244
245
245
public function testWithNotFullButValidCloudEvent ()
@@ -262,10 +262,10 @@ public function invokeThisPartial(CloudEvent $cloudevent)
262
262
{
263
263
$ this ->assertFalse (self ::$ functionCalled );
264
264
self ::$ functionCalled = true ;
265
- $ this ->assertEquals ('fooBar ' , $ cloudevent ->getId ());
266
- $ this ->assertEquals ('my-source ' , $ cloudevent ->getSource ());
267
- $ this ->assertEquals ('1.0 ' , $ cloudevent ->getSpecVersion ());
268
- $ this ->assertEquals ('my.type ' , $ cloudevent ->getType ());
265
+ $ this ->assertSame ('fooBar ' , $ cloudevent ->getId ());
266
+ $ this ->assertSame ('my-source ' , $ cloudevent ->getSource ());
267
+ $ this ->assertSame ('1.0 ' , $ cloudevent ->getSpecVersion ());
268
+ $ this ->assertSame ('my.type ' , $ cloudevent ->getType ());
269
269
}
270
270
271
271
public function testFromLegacyEventWithContextProperty ()
@@ -293,20 +293,20 @@ public function invokeThisLegacy(CloudEvent $cloudevent)
293
293
{
294
294
$ this ->assertFalse (self ::$ functionCalled );
295
295
self ::$ functionCalled = true ;
296
- $ this ->assertEquals ('1413058901901494 ' , $ cloudevent ->getId ());
297
- $ this ->assertEquals (
296
+ $ this ->assertSame ('1413058901901494 ' , $ cloudevent ->getId ());
297
+ $ this ->assertSame (
298
298
'//pubsub.googleapis.com/projects/MY-PROJECT/topics/MY-TOPIC ' ,
299
299
$ cloudevent ->getSource ()
300
300
);
301
- $ this ->assertEquals ('1.0 ' , $ cloudevent ->getSpecVersion ());
302
- $ this ->assertEquals (
301
+ $ this ->assertSame ('1.0 ' , $ cloudevent ->getSpecVersion ());
302
+ $ this ->assertSame (
303
303
'google.cloud.pubsub.topic.v1.messagePublished ' ,
304
304
$ cloudevent ->getType ()
305
305
);
306
- $ this ->assertEquals ('application/json ' , $ cloudevent ->getDataContentType ());
307
- $ this ->assertEquals ( null , $ cloudevent ->getDataSchema ());
308
- $ this ->assertEquals ( null , $ cloudevent ->getSubject ());
309
- $ this ->assertEquals ('2020-12-08T20:03:19.162Z ' , $ cloudevent ->getTime ());
306
+ $ this ->assertSame ('application/json ' , $ cloudevent ->getDataContentType ());
307
+ $ this ->assertNull ( $ cloudevent ->getDataSchema ());
308
+ $ this ->assertNull ( $ cloudevent ->getSubject ());
309
+ $ this ->assertSame ('2020-12-08T20:03:19.162Z ' , $ cloudevent ->getTime ());
310
310
}
311
311
312
312
public function testFromStructuredEventRequest ()
0 commit comments