You are here

class TaskQueueTest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/promises/tests/TaskQueueTest.php \GuzzleHttp\Promise\Test\TaskQueueTest

Hierarchy

  • class \GuzzleHttp\Promise\Test\TaskQueueTest extends \GuzzleHttp\Promise\Test\PHPUnit_Framework_TestCase

Expanded class hierarchy of TaskQueueTest

File

vendor/guzzlehttp/promises/tests/TaskQueueTest.php, line 6

Namespace

GuzzleHttp\Promise\Test
View source
class TaskQueueTest extends \PHPUnit_Framework_TestCase {
  public function testKnowsIfEmpty() {
    $tq = new TaskQueue(false);
    $this
      ->assertTrue($tq
      ->isEmpty());
  }
  public function testKnowsIfFull() {
    $tq = new TaskQueue(false);
    $tq
      ->add(function () {
    });
    $this
      ->assertFalse($tq
      ->isEmpty());
  }
  public function testExecutesTasksInOrder() {
    $tq = new TaskQueue(false);
    $called = [];
    $tq
      ->add(function () use (&$called) {
      $called[] = 'a';
    });
    $tq
      ->add(function () use (&$called) {
      $called[] = 'b';
    });
    $tq
      ->add(function () use (&$called) {
      $called[] = 'c';
    });
    $tq
      ->run();
    $this
      ->assertEquals([
      'a',
      'b',
      'c',
    ], $called);
  }

}

Members