public function testRouteCache() { GCCompiler::cleanup(); $this->_mockRemoteCompiler(); $gcc = new GCCompiler($this->app['config']); $gcc->compile('file1.js'); $time = time(); \File::shouldReceive('exists')->once()->andReturn(true)->shouldReceive('lastModified')->twice()->andReturn($time); $this->call('GET', $gcc->getCompiledJsURL(), array(), array(), array('HTTP_If-Modified-Since' => gmdate('D, d M Y H:i:s \\G\\M\\T', $time))); $this->assertResponseStatus(304); }
/** * Create directories * * @return void */ protected function registerDirectories() { $storagePath = GCCompiler::storagePath(); if (!\File::exists($storagePath)) { \File::makeDirectory($storagePath); chmod($storagePath, 0757); } }
/** * * * @return array */ private function _getBundles() { $this->comment('Searching files...'); $bundles = array(); foreach (\File::allFiles(app_path('views')) as $file) { $this->getOutput()->write('.'); foreach (\Jboysen\LaravelGcc\GCCompiler::findHelperMatches(\File::get($file)) as $bundle) { $bundles[] = $bundle; } } $this->getOutput()->writeln('Done!'); return $bundles; }
public function testWithoutMocks() { GCCompiler::cleanup(); $first = \File::glob(GCCompiler::storagePath(DIRECTORY_SEPARATOR . '*')); $this->assertEquals(0, count($first)); $gcc = new GCCompiler($this->app['config']); $this->assertTrue($gcc->compile('file1.js')); $second = \File::glob(GCCompiler::storagePath(DIRECTORY_SEPARATOR . '*')); $this->assertEquals(1, count($second)); }