@@ -298,13 +298,13 @@ public function testCookie()
298
298
'Acme\DataFixtures\ORM\LoadTweetData ' ,
299
299
]);
300
300
301
- $ tweetId = 49664 ;
301
+ $ firstTweetId = 49664 ;
302
302
303
- $ path = '/sinceId/ ' .$ tweetId ;
303
+ $ path = '/sinceId/ ' .$ firstTweetId ;
304
304
305
305
$ this ->testClient ->enableProfiler ();
306
306
307
- $ this ->testClient ->request ('GET ' , $ path );
307
+ $ crawler = $ this ->testClient ->request ('GET ' , $ path );
308
308
309
309
$ this ->assertStatusCode (200 , $ this ->testClient );
310
310
@@ -317,6 +317,13 @@ public function testCookie()
317
317
);
318
318
}
319
319
320
+ // Number of pending tweets
321
+ $ this ->assertStringContainsString (
322
+ '3 pending tweets ' ,
323
+ $ crawler ->filter ('main.container > div.navigation ' )
324
+ ->first ()->filter ('div.alert-info ' )->text ()
325
+ );
326
+
320
327
// Test the cookie
321
328
$ cookieJar = $ this ->testClient ->getCookieJar ();
322
329
@@ -330,24 +337,31 @@ public function testCookie()
330
337
331
338
// Cookie jar stores string
332
339
$ this ->assertSame (
333
- (string ) $ tweetId ,
340
+ (string ) $ firstTweetId ,
334
341
$ cookieJar ->get ('lastTweetId ' )->getValue ()
335
342
);
336
343
337
344
// Display next tweet
338
- $ nextTweetId = 1210900500 ;
345
+ $ nextTweetId = 210900500 ;
339
346
340
347
$ path = '/sinceId/ ' .$ nextTweetId ;
341
348
342
- $ this ->testClient ->request ('GET ' , $ path );
349
+ $ crawler = $ this ->testClient ->request ('GET ' , $ path );
350
+
351
+ // Number of pending tweets
352
+ $ this ->assertStringContainsString (
353
+ '2 pending tweets ' ,
354
+ $ crawler ->filter ('main.container > div.navigation ' )
355
+ ->first ()->filter ('div.alert-info ' )->text ()
356
+ );
343
357
344
358
// Test that the cookie has been updated to the second tweet in
345
359
// the database (but first on this page)
346
360
$ cookieJar = $ this ->testClient ->getCookieJar ();
347
361
348
362
// Cookie jar stores string
349
363
$ this ->assertSame (
350
- (string ) $ tweetId ,
364
+ (string ) $ nextTweetId ,
351
365
$ cookieJar ->get ('lastTweetId ' )->getValue ()
352
366
);
353
367
@@ -356,14 +370,21 @@ public function testCookie()
356
370
357
371
$ this ->testClient ->followRedirects ();
358
372
359
- $ this ->testClient ->request ('GET ' , $ path );
373
+ $ crawler = $ this ->testClient ->request ('GET ' , $ path );
374
+
375
+ // Number of pending tweets
376
+ $ this ->assertStringContainsString (
377
+ '3 pending tweets ' ,
378
+ $ crawler ->filter ('main.container > div.navigation ' )
379
+ ->first ()->filter ('div.alert-info ' )->text ()
380
+ );
360
381
361
382
$ cookieJar = $ this ->testClient ->getCookieJar ();
362
383
363
384
// Test that the cookie is now the first tweet
364
385
// Cookie jar stores string
365
386
$ this ->assertSame (
366
- (string ) $ tweetId ,
387
+ (string ) $ firstTweetId ,
367
388
$ cookieJar ->get ('lastTweetId ' )->getValue ()
368
389
);
369
390
0 commit comments