public function testFlattenWithDepth() { // No depth flattens recursively $array = [['#foo', ['#bar', ['#baz']]], '#zap']; $this->assertEquals(['#foo', '#bar', '#baz', '#zap'], Arr::flatten($array)); // Specifying a depth only flattens to that depth $array = [['#foo', ['#bar', ['#baz']]], '#zap']; $this->assertEquals(['#foo', ['#bar', ['#baz']], '#zap'], Arr::flatten($array, 1)); $array = [['#foo', ['#bar', ['#baz']]], '#zap']; $this->assertEquals(['#foo', '#bar', ['#baz'], '#zap'], Arr::flatten($array, 2)); }