public function testResolvesToNullWhenNoOtherOptionsAreAvailable() { // Make app return router, and router return an action $this->mockAppRouter(); $this->router->shouldReceive('currentRouteAction')->andReturn('FooController@action'); // Mock corresponding controller for the router action // and assign a theme property to null $this->mockAppController('FooController', null); // Resolver should look for default config option, // so we create a config mock and set it to empty $this->mockAppConfig(); $this->config->shouldReceive('get')->with('themify::default_theme')->andReturn(''); // Check that resolver is resolving to null, // since previous options were not valid $resolver = new Resolver($this->app); $this->assertEquals(null, $resolver->resolve()); }
/** * Get the theme that is going to be loaded. * First, check if a theme has been defined explicitly. * If not, try to resolve using $resolver. * * @return mixed */ public function get() { // Return $currentTheme if not null, resolve otherwise return $this->currentTheme ?: $this->resolver->resolve(); }