|
Last change
on this file since 8f38d1e was 01a620f, checked in by Joachim Langenbach <joachim.langenbach@…>, 11 years ago |
|
Removed submodules for php externals and use composer to provide them and versioned them afterwards
|
-
Property mode
set to
100644
|
|
File size:
826 bytes
|
| Rev | Line | |
|---|
| [01a620f] | 1 | <?php
|
|---|
| 2 | namespace GuzzleHttp\Promise\Test;
|
|---|
| 3 |
|
|---|
| 4 | use GuzzleHttp\Promise\TaskQueue;
|
|---|
| 5 |
|
|---|
| 6 | class TaskQueueTest extends \PHPUnit_Framework_TestCase
|
|---|
| 7 | {
|
|---|
| 8 | public function testKnowsIfEmpty()
|
|---|
| 9 | {
|
|---|
| 10 | $tq = new TaskQueue(false);
|
|---|
| 11 | $this->assertTrue($tq->isEmpty());
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | public function testKnowsIfFull()
|
|---|
| 15 | {
|
|---|
| 16 | $tq = new TaskQueue(false);
|
|---|
| 17 | $tq->add(function () {});
|
|---|
| 18 | $this->assertFalse($tq->isEmpty());
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | public function testExecutesTasksInOrder()
|
|---|
| 22 | {
|
|---|
| 23 | $tq = new TaskQueue(false);
|
|---|
| 24 | $called = [];
|
|---|
| 25 | $tq->add(function () use (&$called) { $called[] = 'a'; });
|
|---|
| 26 | $tq->add(function () use (&$called) { $called[] = 'b'; });
|
|---|
| 27 | $tq->add(function () use (&$called) { $called[] = 'c'; });
|
|---|
| 28 | $tq->run();
|
|---|
| 29 | $this->assertEquals(['a', 'b', 'c'], $called);
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.