PluginProbe
StockPack – Stock photos and AI images from Unsplash, Adobe Stock, Freepik and more / 2.5.2
StockPack – Stock photos and AI images from Unsplash, Adobe Stock, Freepik and more v2.5.2
3.7.2 3.7.1 3.7.0 3.6.0 3.6.1 3.5.2 trunk 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.6.0 2.6.1 All 73 releases
stockpack / vendor / guzzlehttp / promises / tests / TaskQueueTest.php

TaskQueueTest.php in StockPack – Stock photos and AI images from Unsplash, Adobe Stock, Freepik and more 2.5.2, at vendor/guzzlehttp/promises/tests/TaskQueueTest.php

33 lines 839 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace GuzzleHttp\Promise\Test;
3
4 use GuzzleHttp\Promise\TaskQueue;
5 use PHPUnit\Framework\TestCase;
6
7 class TaskQueueTest extends TestCase
8 {
9 public function testKnowsIfEmpty()
10 {
11 $tq = new TaskQueue(false);
12 $this->assertTrue($tq->isEmpty());
13 }
14
15 public function testKnowsIfFull()
16 {
17 $tq = new TaskQueue(false);
18 $tq->add(function () {});
19 $this->assertFalse($tq->isEmpty());
20 }
21
22 public function testExecutesTasksInOrder()
23 {
24 $tq = new TaskQueue(false);
25 $called = [];
26 $tq->add(function () use (&$called) { $called[] = 'a'; });
27 $tq->add(function () use (&$called) { $called[] = 'b'; });
28 $tq->add(function () use (&$called) { $called[] = 'c'; });
29 $tq->run();
30 $this->assertEquals(['a', 'b', 'c'], $called);
31 }
32 }
33