public function AssetCollectionTest::testRecursiveIteration

File

drupal/core/vendor/kriswallsmith/assetic/tests/Assetic/Test/Asset/AssetCollectionTest.php, line 193

Class

AssetCollectionTest

Namespace

Assetic\Test\Asset

Code

public function testRecursiveIteration() {
  $asset1 = $this
    ->getMock('Assetic\\Asset\\AssetInterface');
  $asset2 = $this
    ->getMock('Assetic\\Asset\\AssetInterface');
  $asset3 = $this
    ->getMock('Assetic\\Asset\\AssetInterface');
  $asset4 = $this
    ->getMock('Assetic\\Asset\\AssetInterface');
  $coll3 = new AssetCollection(array(
    $asset1,
    $asset2,
  ));
  $coll2 = new AssetCollection(array(
    $asset3,
    $coll3,
  ));
  $coll1 = new AssetCollection(array(
    $asset4,
    $coll2,
  ));
  $i = 0;
  foreach ($coll1 as $a) {
    $i++;
  }
  $this
    ->assertEquals(4, $i, 'iteration with a recursive iterator is recursive');
}