public function testGettingCascadedPaths() { $theme1 = m::mock('Cartalyst\\Themes\\ThemeInterface'); $theme1->shouldReceive('getSlug')->atLeast(1)->andReturn('foo/bar'); $theme1->shouldReceive('getViewsPath')->once()->andReturn(__DIR__ . '/foo/bar/views'); $theme1->shouldReceive('getParentSlug')->once()->andReturn('foo/baz'); $theme2 = m::mock('Cartalyst\\Themes\\ThemeInterface'); $theme2->shouldReceive('getSlug')->atLeast(1)->andReturn('foo/baz'); $theme2->shouldReceive('getViewsPath')->once()->andReturn(__DIR__ . '/foo/baz/views'); $theme2->shouldReceive('getParentSlug')->once()->andReturn('foo/corge'); $theme4 = m::mock('Cartalyst\\Themes\\ThemeInterface'); $theme4->shouldReceive('getSlug')->atLeast(1)->andReturn('foo/corge'); $theme4->shouldReceive('getViewsPath')->twice()->andReturn(__DIR__ . '/foo/corge/views'); $bag = new ThemeBag($filesystem = new Filesystem(), array(__DIR__)); $bag->setActive($theme1); $bag->register($theme2); $bag->setFallback($theme4); $this->assertCount(3, $paths = $bag->getCascadedViewPaths()); $this->assertEquals(__DIR__ . '/foo/bar/views' . __DIR__ . '/foo/baz/views' . __DIR__ . '/foo/corge/views', implode('', $paths)); $theme4->shouldReceive('getParentSlug')->once(); $this->assertCount(1, $paths = $bag->getCascadedViewPaths($theme4)); $this->assertEquals(__DIR__ . '/foo/corge/views', reset($paths)); }