diff --git a/composer.json b/composer.json index 021026603..83451dc2c 100755 --- a/composer.json +++ b/composer.json @@ -32,6 +32,7 @@ "illuminate/reflection": "^13", "illuminate/session": "^13", "illuminate/support": "^13", + "illuminate/view": "^13", "ircmaxell/password-compat": "~1.0", "laravel/serializable-closure": "^2.0.10", "monolog/monolog": "^3.10", @@ -69,7 +70,6 @@ "illuminate/routing": "self.version", "illuminate/translation": "self.version", "illuminate/validation": "self.version", - "illuminate/view": "self.version", "illuminate/workbench": "self.version" }, "require-dev": { diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index d447f6692..94f501aa4 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -61,6 +61,14 @@ class Application extends Container implements HttpKernelInterface, TerminableIn */ protected $finishCallbacks = array(); + /** + * ponytail: v13 terminating-callback shim (v13 ServiceProviders register + * these; fork Foundation predates the API). Remove at task 4.5 foundation swap. + * + * @var array + */ + protected $terminatingCallbacks = array(); + /** * The array of shutdown callbacks. * @@ -139,6 +147,11 @@ protected function registerBaseBindings($request) $this->instance('request', $request); $this->instance('Illuminate\Container\Container', $this); + + // v13 code resolves the container via the static Container::getInstance() + // (e.g. BladeCompiler::anonymousComponentPath); register the app as the + // global instance so those calls hit the real bindings/aliases (task 4.3). + static::setInstance($this); } /** @@ -635,6 +648,32 @@ public function finish($callback) $this->finishCallbacks[] = $callback; } + /** + * ponytail: v13 Foundation exposes getNamespace() (root PSR-4 namespace) which + * v13's ComponentTagCompiler calls to locate CLASS components. The app uses only + * anonymous components, so the value is never matched — return a benign default + * instead of parsing composer.json. Remove at task 4.5 foundation swap. + * + * @return string + */ + public function getNamespace() + { + return 'App\\'; + } + + /** + * Register a terminating callback (v13 API; see $terminatingCallbacks). + * + * @param callable $callback + * @return $this + */ + public function terminating(callable $callback) + { + $this->terminatingCallbacks[] = $callback; + + return $this; + } + /** * Register a "shutdown" callback. * @@ -900,6 +939,11 @@ public function terminate(SymfonyRequest $request, SymfonyResponse $response): v { $this->callFinishCallbacks($request, $response); + foreach ($this->terminatingCallbacks as $terminating) + { + $this->call($terminating); + } + $this->shutdown(); } @@ -1270,6 +1314,16 @@ public function registerCoreContainerAliases() $this->alias('config', 'Illuminate\Contracts\Config\Repository'); $this->alias('db', 'Illuminate\Database\ConnectionResolverInterface'); + // L13 view swap (task 4.3): v13 view internals (component rendering) resolve + // the Factory contract; alias it to the 'view' binding. + $this->alias('view', 'Illuminate\Contracts\View\Factory'); + + // v13 component rendering autowires the Application/Container contracts; + // mirror v13's 'app' alias cluster (task 4.3). + $this->alias('app', 'Illuminate\Contracts\Foundation\Application'); + $this->alias('app', 'Illuminate\Contracts\Container\Container'); + $this->alias('app', 'Psr\Container\ContainerInterface'); + // ponytail: v13's Support\Facades\Artisan resolves Illuminate\Contracts\Console\Kernel. // The fork has no console Kernel (task 4.2); 'artisan' is a lazy singleton // (ArtisanServiceProvider), so alias the contract to it globally — works for the diff --git a/src/Illuminate/Foundation/Console/OptimizeCommand.php b/src/Illuminate/Foundation/Console/OptimizeCommand.php index c3d4be8ea..b3acfa5a7 100644 --- a/src/Illuminate/Foundation/Console/OptimizeCommand.php +++ b/src/Illuminate/Foundation/Console/OptimizeCommand.php @@ -90,9 +90,11 @@ protected function compileViews() { foreach ($this->laravel['files']->allFiles($path) as $file) { + $viewPath = $file->getRealPath(); + try { - $engine = $this->laravel['view']->getEngineFromPath($file); + $engine = $this->laravel['view']->getEngineFromPath($viewPath); } catch (\InvalidArgumentException $e) { @@ -101,7 +103,7 @@ protected function compileViews() if ($engine instanceof CompilerEngine) { - $engine->getCompiler()->compile($file); + $engine->getCompiler()->compile($viewPath); } } } diff --git a/src/Illuminate/Foundation/Testing/Client.php b/src/Illuminate/Foundation/Testing/Client.php index e97ea39a6..086bf2ffc 100755 --- a/src/Illuminate/Foundation/Testing/Client.php +++ b/src/Illuminate/Foundation/Testing/Client.php @@ -21,6 +21,30 @@ protected function filterRequest(DomRequest $request): \Symfony\Component\HttpFo return $httpRequest; } + /** + * v13 Request::convertUploadedFiles() re-wraps each file via UploadedFile::createFromBase() + * with test=false, so a plain Symfony upload fails isValid()/mimes under tests. Handing back + * Illuminate\Http\UploadedFile instances lets that instanceof check preserve the test flag. + */ + #[\Override] + protected function filterFiles(array $files): array + { + return $this->toTestUploadedFiles(parent::filterFiles($files)); + } + + private function toTestUploadedFiles(array $files): array + { + foreach ($files as $key => $file) { + if (is_array($file)) { + $files[$key] = $this->toTestUploadedFiles($file); + } elseif ($file instanceof \Symfony\Component\HttpFoundation\File\UploadedFile) { + $files[$key] = \Illuminate\Http\UploadedFile::createFromBase($file, true); + } + } + + return $files; + } + /** * Get the request parameters from a BrowserKit request. * diff --git a/tests/View/ViewBladeCompilerTest.php b/tests/View/ViewBladeCompilerTest.php deleted file mode 100644 index 5ac6efd3d..000000000 --- a/tests/View/ViewBladeCompilerTest.php +++ /dev/null @@ -1,627 +0,0 @@ -compiler = new BladeCompiler($this->getFiles(), __DIR__); - } - - protected function tearDown(): void - { - m::close(); - } - - - public function testIsExpiredReturnsTrueIfCompiledFileDoesntExist() - { - $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); - $files->shouldReceive('exists')->once()->with(__DIR__ . '/' . md5('foo'))->andReturn(false); - $this->assertTrue($compiler->isExpired('foo')); - } - - - public function testIsExpiredReturnsTrueIfCachePathIsNull() - { - $compiler = new BladeCompiler($files = $this->getFiles(), null); - $files->shouldReceive('exists')->never(); - $this->assertTrue($compiler->isExpired('foo')); - } - - - public function testIsExpiredReturnsTrueWhenModificationTimesWarrant() - { - $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); - $files->shouldReceive('exists')->once()->with(__DIR__.'/'.md5('foo'))->andReturn(true); - $files->shouldReceive('lastModified')->once()->with('foo')->andReturn(100); - $files->shouldReceive('lastModified')->once()->with(__DIR__.'/'.md5('foo'))->andReturn(0); - $this->assertTrue($compiler->isExpired('foo')); - } - - - public function testCompilePathIsProperlyCreated() - { - $compiler = new BladeCompiler($this->getFiles(), __DIR__); - $this->assertEquals(__DIR__.'/'.md5('foo'), $compiler->getCompiledPath('foo')); - } - - - public function testCompileCompilesFileAndReturnsContents() - { - $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); - $files->shouldReceive('get')->once()->with('foo')->andReturn('Hello World'); - $files->shouldReceive('put')->once()->with(__DIR__.'/'.md5('foo'), 'Hello World'); - $compiler->compile('foo'); - } - - - public function testCompileCompilesAndGetThePath() - { - $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); - $files->shouldReceive('get')->once()->with('foo')->andReturn('Hello World'); - $files->shouldReceive('put')->once()->with(__DIR__.'/'.md5('foo'), 'Hello World'); - $compiler->compile('foo'); - $this->assertEquals('foo', $compiler->getPath()); - } - - - public function testCompileSetAndGetThePath() - { - $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); - $compiler->setPath('foo'); - $this->assertEquals('foo', $compiler->getPath()); - } - - - public function testCompileDoesntStoreFilesWhenCachePathIsNull() - { - $compiler = new BladeCompiler($files = $this->getFiles(), null); - $files->shouldReceive('get')->once()->with('foo')->andReturn('Hello World'); - $files->shouldReceive('put')->never(); - $compiler->compile('foo'); - } - - - public function testEchosAreCompiled() - { - $this->assertEquals('', $this->compiler->compileString('{{{$name}}}')); - $this->assertEquals('', $this->compiler->compileString('{{$name}}')); - $this->assertEquals('', $this->compiler->compileString('{{ $name }}')); - $this->assertEquals('', $this->compiler->compileString('{{ - $name - }}')); - $this->assertEquals("\n\n", $this->compiler->compileString("{{ \$name }}\n")); - $this->assertEquals("\r\n\r\n", $this->compiler->compileString("{{ \$name }}\r\n")); - $this->assertEquals("\n\n", $this->compiler->compileString("{{ \$name }}\n")); - $this->assertEquals("\r\n\r\n", $this->compiler->compileString("{{ \$name }}\r\n")); - - $this->assertEquals('', $this->compiler->compileString('{{ $name or "foo" }}')); - $this->assertEquals('name) ? $user->name : "foo"; ?>', $this->compiler->compileString('{{ $user->name or "foo" }}')); - $this->assertEquals('', $this->compiler->compileString('{{$name or "foo"}}')); - $this->assertEquals('', $this->compiler->compileString('{{ - $name or "foo" - }}')); - - $this->assertEquals('', $this->compiler->compileString('{{ $name or \'foo\' }}')); - $this->assertEquals('', $this->compiler->compileString('{{$name or \'foo\'}}')); - $this->assertEquals('', $this->compiler->compileString('{{ - $name or \'foo\' - }}')); - - $this->assertEquals('', $this->compiler->compileString('{{ $age or 90 }}')); - $this->assertEquals('', $this->compiler->compileString('{{$age or 90}}')); - $this->assertEquals('', $this->compiler->compileString('{{ - $age or 90 - }}')); - - $this->assertEquals('', $this->compiler->compileString('{{ "Hello world or foo" }}')); - $this->assertEquals('', $this->compiler->compileString('{{"Hello world or foo"}}')); - $this->assertEquals('', $this->compiler->compileString('{{$foo + $or + $baz}}')); - $this->assertEquals('', $this->compiler->compileString('{{ - "Hello world or foo" - }}')); - - $this->assertEquals('', $this->compiler->compileString('{{ \'Hello world or foo\' }}')); - $this->assertEquals('', $this->compiler->compileString('{{\'Hello world or foo\'}}')); - $this->assertEquals('', $this->compiler->compileString('{{ - \'Hello world or foo\' - }}')); - - $this->assertEquals('', $this->compiler->compileString('{{ myfunc(\'foo or bar\') }}')); - $this->assertEquals('', $this->compiler->compileString('{{ myfunc("foo or bar") }}')); - $this->assertEquals('', $this->compiler->compileString('{{ myfunc("$name or \'foo\'") }}')); - } - - - public function testEscapedWithAtEchosAreCompiled() - { - $this->assertEquals('{{$name}}', $this->compiler->compileString('@{{$name}}')); - $this->assertEquals('{{ $name }}', $this->compiler->compileString('@{{ $name }}')); - $this->assertEquals('{{ - $name - }}', - $this->compiler->compileString('@{{ - $name - }}')); - $this->assertEquals('{{ $name }} - ', - $this->compiler->compileString('@{{ $name }} - ')); - } - - - public function testReversedEchosAreCompiled() - { - $this->compiler->setEscapedContentTags('{{', '}}'); - $this->compiler->setContentTags('{{{', '}}}'); - $this->assertEquals('', $this->compiler->compileString('{{$name}}')); - $this->assertEquals('', $this->compiler->compileString('{{{$name}}}')); - $this->assertEquals('', $this->compiler->compileString('{{{ $name }}}')); - $this->assertEquals('', $this->compiler->compileString('{{{ - $name - }}}')); - } - - - public function testExtendsAreCompiled() - { - $compiler = new BladeCompiler($this->getFiles(), __DIR__); - $string = '@extends(\'foo\') -test'; - $expected = "test".PHP_EOL.'make(\'foo\', array_except(get_defined_vars(), array(\'__data\', \'__path\')))->render(); ?>'; - $this->assertEquals($expected, $compiler->compileString($string)); - - - $compiler = new BladeCompiler($this->getFiles(), __DIR__); - $string = '@extends(name(foo))'.PHP_EOL.'test'; - $expected = "test".PHP_EOL.'make(name(foo), array_except(get_defined_vars(), array(\'__data\', \'__path\')))->render(); ?>'; - $this->assertEquals($expected, $compiler->compileString($string)); - } - - - public function testPushIsCompiled() - { - $string = '@push(\'foo\') -test -@endpush'; - $expected = 'startSection(\'foo\'); ?> -test -appendSection(); ?>'; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testStackIsCompiled() - { - $string = '@stack(\'foo\')'; - $expected = 'yieldContent(\'foo\'); ?>'; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testCommentsAreCompiled() - { - $string = '{{--this is a comment--}}'; - $expected = ''; - $this->assertEquals($expected, $this->compiler->compileString($string)); - - - $string = '{{-- -this is a comment ---}}'; - $expected = ''; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testIfStatementsAreCompiled() - { - $string = '@if (name(foo(bar))) -breeze -@endif'; - $expected = ' -breeze -'; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testElseStatementsAreCompiled() - { - $string = '@if (name(foo(bar))) -breeze -@else -boom -@endif'; - $expected = ' -breeze - -boom -'; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testElseIfStatementsAreCompiled() - { - $string = '@if(name(foo(bar))) -breeze -@elseif(boom(breeze)) -boom -@endif'; - $expected = ' -breeze - -boom -'; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testUnlessStatementsAreCompiled() - { - $string = '@unless (name(foo(bar))) -breeze -@endunless'; - $expected = ' -breeze -'; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testForelseStatementsAreCompiled() - { - $string = '@forelse ($this->getUsers() as $user) -breeze -@empty -empty -@endforelse'; - $expected = 'getUsers() as $user): $__empty_1 = false; ?> -breeze - -empty -'; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testNestedForelseStatementsAreCompiled() - { - $string = '@forelse ($this->getUsers() as $user) -@forelse ($user->tags as $tag) -breeze -@empty -tag empty -@endforelse -@empty -empty -@endforelse'; - $expected = 'getUsers() as $user): $__empty_1 = false; ?> -tags as $tag): $__empty_2 = false; ?> -breeze - -tag empty - - -empty -'; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testStatementThatContainsNonConsecutiveParanthesisAreCompiled() - { - $string = "Foo @lang(function_call('foo(blah)')) bar"; - $expected = "Foo bar"; - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testIncludesAreCompiled() - { - $this->assertEquals('make(\'foo\', array_except(get_defined_vars(), array(\'__data\', \'__path\')))->render(); ?>', $this->compiler->compileString('@include(\'foo\')')); - $this->assertEquals('make(name(foo), array_except(get_defined_vars(), array(\'__data\', \'__path\')))->render(); ?>', $this->compiler->compileString('@include(name(foo))')); - } - - - public function testShowEachAreCompiled() - { - $this->assertEquals('renderEach(\'foo\', \'bar\'); ?>', $this->compiler->compileString('@each(\'foo\', \'bar\')')); - $this->assertEquals('renderEach(name(foo)); ?>', $this->compiler->compileString('@each(name(foo))')); - } - - - public function testYieldsAreCompiled() - { - $this->assertEquals('yieldContent(\'foo\'); ?>', $this->compiler->compileString('@yield(\'foo\')')); - $this->assertEquals('yieldContent(\'foo\', \'bar\'); ?>', $this->compiler->compileString('@yield(\'foo\', \'bar\')')); - $this->assertEquals('yieldContent(name(foo)); ?>', $this->compiler->compileString('@yield(name(foo))')); - } - - - public function testShowsAreCompiled() - { - $this->assertEquals('yieldSection(); ?>', $this->compiler->compileString('@show')); - } - - - public function testLanguageAndChoicesAreCompiled() - { - $this->assertEquals('', $this->compiler->compileString("@lang('foo')")); - $this->assertEquals('', $this->compiler->compileString("@choice('foo', 1)")); - } - - - public function testSectionStartsAreCompiled() - { - $this->assertEquals('startSection(\'foo\'); ?>', $this->compiler->compileString('@section(\'foo\')')); - $this->assertEquals('startSection(name(foo)); ?>', $this->compiler->compileString('@section(name(foo))')); - } - - - public function testStopSectionsAreCompiled() - { - $this->assertEquals('stopSection(); ?>', $this->compiler->compileString('@stop')); - } - - - public function testEndSectionsAreCompiled() - { - $this->assertEquals('stopSection(); ?>', $this->compiler->compileString('@endsection')); - } - - - public function testAppendSectionsAreCompiled() - { - $this->assertEquals('appendSection(); ?>', $this->compiler->compileString('@append')); - } - - - public function testCustomPhpCodeIsCorrectlyHandled() - { - $this->assertEquals(' ', $this->compiler->compileString("@if(\$test) @endif")); - } - - - public function testMixingYieldAndEcho() - { - $this->assertEquals('yieldContent(\'title\'); ?> - ', $this->compiler->compileString("@yield('title') - {{Config::get('site.title')}}")); - } - - - public function testCustomExtensionsAreCompiled() - { - $this->compiler->extend(function($value) { return str_replace('foo', 'bar', $value); }); - $this->assertEquals('bar', $this->compiler->compileString('foo')); - } - - - public function testConfiguringContentTags() - { - $this->compiler->setContentTags('[[', ']]'); - $this->compiler->setEscapedContentTags('[[[', ']]]'); - - $this->assertEquals('', $this->compiler->compileString('[[[ $name ]]]')); - $this->assertEquals('', $this->compiler->compileString('[[ $name ]]')); - $this->assertEquals('', $this->compiler->compileString('[[ - $name - ]]')); - } - - - public function testExpressionsOnTheSameLine() - { - $this->assertEquals(' space () ', $this->compiler->compileString('@lang(foo(bar(baz(qux(breeze()))))) space () @lang(foo(bar))')); - } - - - public function testExpressionWithinHTML() - { - $this->assertEquals('>', $this->compiler->compileString('')); - $this->assertEquals('>', $this->compiler->compileString('')); - $this->assertEquals(' >', $this->compiler->compileString('')); - } - - - public function testSelectedStatementsAreCompiled() - { - $string = ''; - $expected = "/>"; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testCheckedStatementsAreCompiled() - { - $string = ''; - $expected = "/>"; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testDisabledStatementsAreCompiled() - { - $string = ''; - $expected = ""; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testClassesAreConditionallyCompiledFromArray() - { - $string = " true, 'mr-2' => false])>"; - $expected = " true, 'mr-2' => false])); ?>\">"; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testJsonIsCompiledWithSafeDefaultEncodingOptions() - { - $string = 'var foo = @json($var);'; - $expected = 'var foo = ;'; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testEnvStatementsAreCompiled() - { - $string = "@env('staging') -breeze -@else -boom -@endenv"; - $expected = "environment('staging')): ?> -breeze - -boom -"; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testEnvStatementsWithMultipleStringParamsAreCompiled() - { - $string = "@env('staging', 'production') -breeze -@else -boom -@endenv"; - $expected = "environment('staging', 'production')): ?> -breeze - -boom -"; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testEnvStatementsWithArrayParamAreCompiled() - { - $string = "@env(['staging', 'production']) -breeze -@else -boom -@endenv"; - $expected = "environment(['staging', 'production'])): ?> -breeze - -boom -"; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testProductionEnvStatementsAreCompiled() - { - $string = "@production -breeze -@else -boom -@endproduction"; - $expected = "environment('production')): ?> -breeze - -boom -"; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testPlainAuthIfStatementsAreCompiled() - { - $string = '@auth -breeze -@endauth'; - $expected = ' -breeze -'; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - public function testPlainGuestIfStatementsAreCompiled() - { - $string = '@guest -breeze -@endguest'; - $expected = ' -breeze -'; - - $this->assertEquals($expected, $this->compiler->compileString($string)); - } - - - protected function getFiles() - { - return m::mock('Illuminate\Filesystem\Filesystem'); - } - - - public function testRetrieveDefaultContentTags() - { - $this->assertEquals(['{{', '}}'], $this->compiler->getContentTags()); - } - - - public function testRetrieveDefaultEscapedContentTags() - { - $this->assertEquals(['{{{', '}}}'], $this->compiler->getEscapedContentTags()); - } - - - /** - * @dataProvider testGetTagsProvider() - */ - public function testSetAndRetrieveContentTags($openingTag, $closingTag) - { - $this->compiler->setContentTags($openingTag, $closingTag); - $this->assertSame([$openingTag, $closingTag], $this->compiler->getContentTags()); - } - - - /** - * @dataProvider testGetTagsProvider() - */ - public function testSetAndRetrieveEscapedContentTags($openingTag, $closingTag) - { - $this->compiler->setEscapedContentTags($openingTag, $closingTag); - $this->assertSame([$openingTag, $closingTag], $this->compiler->getEscapedContentTags()); - } - - - public function testGetTagsProvider() - { - return [ - ['{{', '}}'], - ['{{{', '}}}'], - ['[[', ']]'], - ['[[[', ']]]'], - ['((', '))'], - ['(((', ')))'], - ]; - } - -} diff --git a/tests/View/ViewCompilerEngineTest.php b/tests/View/ViewCompilerEngineTest.php deleted file mode 100755 index 0d388ee5c..000000000 --- a/tests/View/ViewCompilerEngineTest.php +++ /dev/null @@ -1,50 +0,0 @@ -getEngine(); - $engine->getCompiler()->shouldReceive('getCompiledPath')->with(__DIR__ . '/fixtures/foo.php')->andReturn( - __DIR__ . '/fixtures/basic.php' - ); - $engine->getCompiler()->shouldReceive('isExpired')->once()->with(__DIR__ . '/fixtures/foo.php')->andReturn( - true - ); - $engine->getCompiler()->shouldReceive('compile')->once()->with(__DIR__.'/fixtures/foo.php'); - $results = $engine->get(__DIR__.'/fixtures/foo.php'); - - $this->assertEquals("Hello World\n", $results); - } - - - public function testViewsAreNotRecompiledIfTheyAreNotExpired() - { - $engine = $this->getEngine(); - $engine->getCompiler()->shouldReceive('getCompiledPath')->with(__DIR__.'/fixtures/foo.php')->andReturn(__DIR__.'/fixtures/basic.php'); - $engine->getCompiler()->shouldReceive('isExpired')->once()->andReturn(false); - $engine->getCompiler()->shouldReceive('compile')->never(); - $results = $engine->get(__DIR__.'/fixtures/foo.php'); - - $this->assertEquals("Hello World\n", $results); - } - - - protected function getEngine() - { - return new CompilerEngine(m::mock(CompilerInterface::class)); - } - -} diff --git a/tests/View/ViewEngineResolverTest.php b/tests/View/ViewEngineResolverTest.php deleted file mode 100755 index 92d5d9976..000000000 --- a/tests/View/ViewEngineResolverTest.php +++ /dev/null @@ -1,24 +0,0 @@ -register('foo', function() { return new StdClass; }); - $result = $resolver->resolve('foo'); - - $this->assertEquals(spl_object_hash($result), spl_object_hash($resolver->resolve('foo'))); - } - - - public function testResolverThrowsExceptionOnUnknownEngine() - { - $this->expectException('InvalidArgumentException'); - $resolver = new Illuminate\View\Engines\EngineResolver; - $resolver->resolve('foo'); - } - -} diff --git a/tests/View/ViewFactoryTest.php b/tests/View/ViewFactoryTest.php deleted file mode 100755 index 83ee781b3..000000000 --- a/tests/View/ViewFactoryTest.php +++ /dev/null @@ -1,378 +0,0 @@ -getFactory(); - $factory->getFinder()->shouldReceive('find')->once()->with('view')->andReturn('path.php'); - $factory->getEngineResolver()->shouldReceive('resolve')->once()->with('php')->andReturn($engine = m::mock( - EngineInterface::class - )); - $factory->getFinder()->shouldReceive('addExtension')->once()->with('php'); - $factory->setDispatcher(new Illuminate\Events\Dispatcher); - $factory->creator('view', function($view) { $_SERVER['__test.view'] = $view; }); - $factory->addExtension('php', 'php'); - $view = $factory->make('view', ['foo' => 'bar'], ['baz' => 'boom']); - - $this->assertSame($engine, $view->getEngine()); - $this->assertSame($_SERVER['__test.view'], $view); - - unset($_SERVER['__test.view']); - } - - - public function testExistsPassesAndFailsViews() - { - $factory = $this->getFactory(); - $factory->getFinder()->shouldReceive('find')->once()->with('foo')->andThrow('InvalidArgumentException'); - $factory->getFinder()->shouldReceive('find')->once()->with('bar')->andReturn('path.php'); - - $this->assertFalse($factory->exists('foo')); - $this->assertTrue($factory->exists('bar')); - } - - - public function testRenderEachCreatesViewForEachItemInArray() - { - $factory = m::mock('Illuminate\View\Factory[make]', $this->getFactoryArgs()); - $factory->shouldReceive('make')->once()->with('foo', ['key' => 'bar', 'value' => 'baz'])->andReturn($mockView1 = m::mock('StdClass')); - $factory->shouldReceive('make')->once()->with('foo', ['key' => 'breeze', 'value' => 'boom'])->andReturn($mockView2 = m::mock('StdClass')); - $mockView1->shouldReceive('render')->once()->andReturn('dayle'); - $mockView2->shouldReceive('render')->once()->andReturn('rees'); - - $result = $factory->renderEach('foo', ['bar' => 'baz', 'breeze' => 'boom'], 'value'); - - $this->assertEquals('daylerees', $result); - } - - - public function testEmptyViewsCanBeReturnedFromRenderEach() - { - $factory = m::mock('Illuminate\View\Factory[make]', $this->getFactoryArgs()); - $factory->shouldReceive('make')->once()->with('foo')->andReturn($mockView = m::mock('StdClass')); - $mockView->shouldReceive('render')->once()->andReturn('empty'); - - $this->assertEquals('empty', $factory->renderEach('view', [], 'iterator', 'foo')); - } - - - public function testRawStringsMayBeReturnedFromRenderEach() - { - $this->assertEquals('foo', $this->getFactory()->renderEach('foo', [], 'item', 'raw|foo')); - } - - - public function testEnvironmentAddsExtensionWithCustomResolver() - { - $factory = $this->getFactory(); - - $resolver = function(){}; - - $factory->getFinder()->shouldReceive('addExtension')->once()->with('foo'); - $factory->getEngineResolver()->shouldReceive('register')->once()->with('bar', $resolver); - $factory->getFinder()->shouldReceive('find')->once()->with('view')->andReturn('path.foo'); - $factory->getEngineResolver()->shouldReceive('resolve')->once()->with('bar')->andReturn($engine = m::mock( - EngineInterface::class - )); - $factory->getDispatcher()->shouldReceive('dispatch'); - - $factory->addExtension('foo', 'bar', $resolver); - - $view = $factory->make('view', ['data']); - $this->assertSame($engine, $view->getEngine()); - } - - - public function testAddingExtensionPrependsNotAppends() - { - $factory = $this->getFactory(); - $factory->getFinder()->shouldReceive('addExtension')->once()->with('foo'); - - $factory->addExtension('foo', 'bar'); - - $extensions = $factory->getExtensions(); - $this->assertEquals('bar', reset($extensions)); - $this->assertEquals('foo', key($extensions)); - } - - - public function testPrependedExtensionOverridesExistingExtensions() - { - $factory = $this->getFactory(); - $factory->getFinder()->shouldReceive('addExtension')->once()->with('foo'); - $factory->getFinder()->shouldReceive('addExtension')->once()->with('baz'); - - $factory->addExtension('foo', 'bar'); - $factory->addExtension('baz', 'bar'); - - $extensions = $factory->getExtensions(); - $this->assertEquals('bar', reset($extensions)); - $this->assertEquals('baz', key($extensions)); - } - - - public function testComposersAreProperlyRegistered() - { - $factory = $this->getFactory(); - $factory->getDispatcher()->shouldReceive('listen')->once()->with('composing: foo', m::type('Closure')); - $callback = $factory->composer('foo', function() { return 'bar'; }); - $callback = $callback[0]; - - $this->assertEquals('bar', $callback()); - } - - - public function testComposersAreProperlyRegisteredWithPriority() - { - $factory = $this->getFactory(); - $factory->getDispatcher()->shouldReceive('listen')->once()->with('composing: foo', m::type('Closure'), 1); - $callback = $factory->composer('foo', function() { return 'bar'; }, 1); - $callback = $callback[0]; - - $this->assertEquals('bar', $callback()); - } - - - public function testComposersCanBeMassRegistered() - { - $factory = $this->getFactory(); - $factory->getDispatcher()->shouldReceive('listen')->once()->with('composing: bar', m::type('Closure')); - $factory->getDispatcher()->shouldReceive('listen')->once()->with('composing: qux', m::type('Closure')); - $factory->getDispatcher()->shouldReceive('listen')->once()->with('composing: foo', m::type('Closure')); - $composers = $factory->composers([ - 'foo' => 'bar', - 'baz@baz' => ['qux', 'foo'], - ]); - - $this->assertCount(3, $composers); - $reflections = [ - new ReflectionFunction($composers[0]), - new ReflectionFunction($composers[1]), - ]; - $this->assertEquals(['class' => 'foo', 'method' => 'compose', 'container' => null], $reflections[0]->getStaticVariables()); - $this->assertEquals(['class' => 'baz', 'method' => 'baz', 'container' => null], $reflections[1]->getStaticVariables()); - } - - - public function testClassCallbacks() - { - $factory = $this->getFactory(); - $factory->getDispatcher()->shouldReceive('listen')->once()->with('composing: foo', m::type('Closure')); - $factory->setContainer($container = m::mock(Container::class)); - $container->shouldReceive('make')->once()->with('FooComposer')->andReturn($composer = m::mock('StdClass')); - $composer->shouldReceive('compose')->once()->with('view')->andReturn('composed'); - $callback = $factory->composer('foo', 'FooComposer'); - $callback = $callback[0]; - - $this->assertEquals('composed', $callback('view')); - } - - - public function testClassCallbacksWithMethods() - { - $factory = $this->getFactory(); - $factory->getDispatcher()->shouldReceive('listen')->once()->with('composing: foo', m::type('Closure')); - $factory->setContainer($container = m::mock(Container::class)); - $container->shouldReceive('make')->once()->with('FooComposer')->andReturn($composer = m::mock('StdClass')); - $composer->shouldReceive('doComposer')->once()->with('view')->andReturn('composed'); - $callback = $factory->composer('foo', 'FooComposer@doComposer'); - $callback = $callback[0]; - - $this->assertEquals('composed', $callback('view')); - } - - - public function testCallComposerCallsProperEvent() - { - $factory = $this->getFactory(); - $view = m::mock(View::class); - $view->shouldReceive('getName')->once()->andReturn('name'); - $factory->getDispatcher()->shouldReceive('dispatch')->once()->with('composing: name', [$view]); - - $factory->callComposer($view); - } - - - public function testRenderCountHandling() - { - $factory = $this->getFactory(); - $factory->incrementRender(); - $this->assertFalse($factory->doneRendering()); - $factory->decrementRender(); - $this->assertTrue($factory->doneRendering()); - } - - - public function testBasicSectionHandling() - { - $factory = $this->getFactory(); - $factory->startSection('foo'); - echo 'hi'; - $factory->stopSection(); - $this->assertEquals('hi', $factory->yieldContent('foo')); - } - - - public function testSectionExtending() - { - $factory = $this->getFactory(); - $factory->startSection('foo'); - echo 'hi @parent'; - $factory->stopSection(); - $factory->startSection('foo'); - echo 'there'; - $factory->stopSection(); - $this->assertEquals('hi there', $factory->yieldContent('foo')); - } - - - public function testSingleStackPush() - { - $factory = $this->getFactory(); - $factory->startSection('foo'); - echo 'hi'; - $factory->appendSection(); - $this->assertEquals('hi', $factory->yieldContent('foo')); - } - - - public function testMultipleStackPush() - { - $factory = $this->getFactory(); - $factory->startSection('foo'); - echo 'hi'; - $factory->appendSection(); - $factory->startSection('foo'); - echo ', Hello!'; - $factory->appendSection(); - $this->assertEquals('hi, Hello!', $factory->yieldContent('foo')); - } - - - public function testSessionAppending() - { - $factory = $this->getFactory(); - $factory->startSection('foo'); - echo 'hi'; - $factory->appendSection(); - $factory->startSection('foo'); - echo 'there'; - $factory->appendSection(); - $this->assertEquals('hithere', $factory->yieldContent('foo')); - } - - - public function testYieldSectionStopsAndYields() - { - $factory = $this->getFactory(); - $factory->startSection('foo'); - echo 'hi'; - $this->assertEquals('hi', $factory->yieldSection()); - } - - - public function testInjectStartsSectionWithContent() - { - $factory = $this->getFactory(); - $factory->inject('foo', 'hi'); - $this->assertEquals('hi', $factory->yieldContent('foo')); - } - - - public function testEmptyStringIsReturnedForNonSections() - { - $factory = $this->getFactory(); - $this->assertEquals('', $factory->yieldContent('foo')); - } - - - public function testSectionFlushing() - { - $factory = $this->getFactory(); - $factory->startSection('foo'); - echo 'hi'; - $factory->stopSection(); - - $this->assertCount(1, $factory->getSections()); - - $factory->flushSections(); - - $this->assertCount(0, $factory->getSections()); - } - - - public function testExceptionIsThrownForUnknownExtension() - { - $this->expectException('InvalidArgumentException'); - $factory = $this->getFactory(); - $factory->getFinder()->shouldReceive('find')->once()->with('view')->andReturn('view.foo'); - $factory->make('view'); - } - - - public function testExceptionsInSectionsAreThrown() - { - $engine = new CompilerEngine(m::mock(CompilerInterface::class)); - $engine->getCompiler()->shouldReceive('getCompiledPath')->andReturnUsing( - function ($path) { - return $path; - } - ); - $engine->getCompiler()->shouldReceive('isExpired')->twice()->andReturn(false); - $factory = $this->getFactory(); - $factory->getEngineResolver()->shouldReceive('resolve')->twice()->andReturn($engine); - $factory->getFinder()->shouldReceive('find')->once()->with('layout')->andReturn( - __DIR__ . '/fixtures/section-exception-layout.php' - ); - $factory->getFinder()->shouldReceive('find')->once()->with('view')->andReturn( - __DIR__ . '/fixtures/section-exception.php' - ); - $factory->getDispatcher()->shouldReceive('dispatch')->times(4); - - $this->expectException('Exception', 'section exception message'); - $factory->make('view')->render(); - } - - - protected function getFactory() - { - return new Factory( - m::mock(EngineResolver::class), - m::mock(ViewFinderInterface::class), - m::mock(Dispatcher::class) - ); - } - - - protected function getFactoryArgs() - { - return [ - m::mock(EngineResolver::class), - m::mock(ViewFinderInterface::class), - m::mock(Dispatcher::class), - ]; - } - -} diff --git a/tests/View/ViewFinderTest.php b/tests/View/ViewFinderTest.php deleted file mode 100755 index 8987a2214..000000000 --- a/tests/View/ViewFinderTest.php +++ /dev/null @@ -1,155 +0,0 @@ -getFinder(); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__ . '/foo.blade.php')->andReturn(true); - - $this->assertEquals(__DIR__.'/foo.blade.php', $finder->find('foo')); - } - - - public function testCascadingFileLoading() - { - $finder = $this->getFinder(); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.blade.php')->andReturn(false); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.php')->andReturn(true); - - $this->assertEquals(__DIR__.'/foo.php', $finder->find('foo')); - } - - - public function testDirectoryCascadingFileLoading() - { - $finder = $this->getFinder(); - $finder->addLocation(__DIR__.'/nested'); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.blade.php')->andReturn(false); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo.php')->andReturn(false); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/nested/foo.blade.php')->andReturn(true); - - $this->assertEquals(__DIR__.'/nested/foo.blade.php', $finder->find('foo')); - } - - - public function testNamespacedBasicFileLoading() - { - $finder = $this->getFinder(); - $finder->addNamespace('foo', __DIR__.'/foo'); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo/bar/baz.blade.php')->andReturn(true); - - $this->assertEquals(__DIR__.'/foo/bar/baz.blade.php', $finder->find('foo::bar.baz')); - } - - - public function testCascadingNamespacedFileLoading() - { - $finder = $this->getFinder(); - $finder->addNamespace('foo', __DIR__.'/foo'); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo/bar/baz.blade.php')->andReturn(false); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo/bar/baz.php')->andReturn(true); - - $this->assertEquals(__DIR__.'/foo/bar/baz.php', $finder->find('foo::bar.baz')); - } - - - public function testDirectoryCascadingNamespacedFileLoading() - { - $finder = $this->getFinder(); - $finder->addNamespace('foo', [__DIR__.'/foo', __DIR__.'/bar']); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo/bar/baz.blade.php')->andReturn(false); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/foo/bar/baz.php')->andReturn(false); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__.'/bar/bar/baz.blade.php')->andReturn(true); - - $this->assertEquals(__DIR__.'/bar/bar/baz.blade.php', $finder->find('foo::bar.baz')); - } - - - public function testExceptionThrownWhenViewNotFound() - { - $this->expectException(InvalidArgumentException::class); - $finder = $this->getFinder(); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__ . '/foo.blade.php')->andReturn(false); - $finder->getFilesystem()->shouldReceive('exists')->once()->with(__DIR__ . '/foo.php')->andReturn(false); - - $finder->find('foo'); - } - - - public function testExceptionThrownOnInvalidViewName() - { - $this->expectException(InvalidArgumentException::class); - $finder = $this->getFinder(); - $finder->find('name::'); - } - - - public function testExceptionThrownWhenNoHintPathIsRegistered() - { - $this->expectException(InvalidArgumentException::class); - $finder = $this->getFinder(); - $finder->find('name::foo'); - } - - - public function testAddingExtensionPrependsNotAppends() - { - $finder = $this->getFinder(); - $finder->addExtension('baz'); - $extensions = $finder->getExtensions(); - $this->assertEquals('baz', reset($extensions)); - } - - - public function testAddingExtensionsReplacesOldOnes() - { - $finder = $this->getFinder(); - $finder->addExtension('baz'); - $finder->addExtension('baz'); - - $this->assertCount(3, $finder->getExtensions()); - } - - - public function testPassingViewWithHintReturnsTrue() - { - $finder = $this->getFinder(); - - $this->assertTrue($finder->hasHintInformation('hint::foo.bar')); - } - - - public function testPassingViewWithoutHintReturnsFalse() - { - $finder = $this->getFinder(); - - $this->assertFalse($finder->hasHintInformation('foo.bar')); - } - - - public function testPassingViewWithFalseHintReturnsFalse() - { - $finder = $this->getFinder(); - - $this->assertFalse($finder->hasHintInformation('::foo.bar')); - } - - - protected function getFinder() - { - return new Illuminate\View\FileViewFinder(m::mock(Filesystem::class), [__DIR__]); - } - -} diff --git a/tests/View/ViewPhpEngineTest.php b/tests/View/ViewPhpEngineTest.php deleted file mode 100755 index bdcccf7f3..000000000 --- a/tests/View/ViewPhpEngineTest.php +++ /dev/null @@ -1,22 +0,0 @@ -assertEquals("Hello World\n", $engine->get(__DIR__ . '/fixtures/basic.php')); - } - -} diff --git a/tests/View/ViewTest.php b/tests/View/ViewTest.php deleted file mode 100755 index b85d7ab38..000000000 --- a/tests/View/ViewTest.php +++ /dev/null @@ -1,232 +0,0 @@ -with('foo', 'bar'); - $view->with(['baz' => 'boom']); - $this->assertEquals(['foo' => 'bar', 'baz' => 'boom'], $view->getData()); - - - $view = new View(m::mock(Factory::class), m::mock( - EngineInterface::class - ), 'view', 'path', [] - ); - $view->withFoo('bar')->withBaz('boom'); - $this->assertEquals(['foo' => 'bar', 'baz' => 'boom'], $view->getData()); - } - - - public function testRenderProperlyRendersView() - { - $view = $this->getView(); - $view->getFactory()->shouldReceive('incrementRender')->once()->ordered(); - $view->getFactory()->shouldReceive('callComposer')->once()->ordered()->with($view); - $view->getFactory()->shouldReceive('getShared')->once()->andReturn(['shared' => 'foo']); - $view->getEngine()->shouldReceive('get')->once()->with('path', ['foo' => 'bar', 'shared' => 'foo'])->andReturn('contents'); - $view->getFactory()->shouldReceive('decrementRender')->once()->ordered(); - $view->getFactory()->shouldReceive('flushStateIfDoneRendering')->once(); - - $me = $this; - $callback = function(View $rendered, $contents) use ($me, $view) - { - $me->assertEquals($view, $rendered); - $me->assertEquals('contents', $contents); - }; - - $this->assertEquals('contents', $view->render($callback)); - } - - - public function testRenderSectionsReturnsEnvironmentSections() - { - $view = m::mock('Illuminate\View\View[render]', [ - m::mock(Factory::class), - m::mock(EngineInterface::class), - 'view', - 'path', - [], - ]); - - $view->shouldReceive('render')->with(m::type('Closure'))->once()->andReturn($sections = ['foo' => 'bar']); - - $this->assertEquals($sections, $view->renderSections()); - } - - - public function testSectionsAreNotFlushedWhenNotDoneRendering() - { - $view = $this->getView(); - $view->getFactory()->shouldReceive('incrementRender')->twice(); - $view->getFactory()->shouldReceive('callComposer')->twice()->with($view); - $view->getFactory()->shouldReceive('getShared')->twice()->andReturn(['shared' => 'foo']); - $view->getEngine()->shouldReceive('get')->twice()->with('path', ['foo' => 'bar', 'shared' => 'foo'])->andReturn('contents'); - $view->getFactory()->shouldReceive('decrementRender')->twice(); - $view->getFactory()->shouldReceive('flushStateIfDoneRendering')->twice(); - - $this->assertEquals('contents', $view->render()); - $this->assertEquals('contents', (string) $view); - } - - - public function testViewNestBindsASubView() - { - $view = $this->getView(); - $view->getFactory()->shouldReceive('make')->once()->with('foo', ['data']); - $result = $view->nest('key', 'foo', ['data']); - - $this->assertInstanceOf(View::class, $result); - } - - - public function testViewAcceptsArrayableImplementations() - { - $arrayable = m::mock(ArrayableInterface::class); - $arrayable->shouldReceive('toArray')->once()->andReturn(['foo' => 'bar', 'baz' => ['qux', 'corge']]); - - $view = new View( - m::mock(Factory::class), - m::mock(EngineInterface::class), - 'view', - 'path', - $arrayable - ); - - $this->assertEquals('bar', $view->foo); - $this->assertEquals(['qux', 'corge'], $view->baz); - } - - - public function testViewGettersSetters() - { - $view = $this->getView(); - $this->assertEquals($view->getName(), 'view'); - $this->assertEquals($view->getPath(), 'path'); - $data = $view->getData(); - $this->assertEquals($data['foo'], 'bar'); - $view->setPath('newPath'); - $this->assertEquals($view->getPath(), 'newPath'); - } - - - public function testViewArrayAccess() - { - $view = $this->getView(); - $this->assertInstanceOf('ArrayAccess', $view); - $this->assertTrue($view->offsetExists('foo')); - $this->assertEquals($view->offsetGet('foo'), 'bar'); - $view->offsetSet('foo','baz'); - $this->assertEquals($view->offsetGet('foo'), 'baz'); - $view->offsetUnset('foo'); - $this->assertFalse($view->offsetExists('foo')); - } - - - public function testViewMagicMethods() - { - $view = $this->getView(); - $this->assertTrue(isset($view->foo)); - $this->assertEquals($view->foo, 'bar'); - $view->foo = 'baz'; - $this->assertEquals($view->foo, 'baz'); - $this->assertEquals($view['foo'], $view->foo); - unset($view->foo); - $this->assertFalse(isset($view->foo)); - $this->assertFalse($view->offsetExists('foo')); - } - - - public function testViewBadMethod() - { - $this->expectException('BadMethodCallException'); - $view = $this->getView(); - $view->badMethodCall(); - } - - - public function testViewGatherDataWithRenderable() - { - $view = $this->getView(); - $view->getFactory()->shouldReceive('incrementRender')->once()->ordered(); - $view->getFactory()->shouldReceive('callComposer')->once()->ordered()->with($view); - $view->getFactory()->shouldReceive('getShared')->once()->andReturn(['shared' => 'foo']); - $view->getEngine()->shouldReceive('get')->once()->andReturn('contents'); - $view->getFactory()->shouldReceive('decrementRender')->once()->ordered(); - $view->getFactory()->shouldReceive('flushStateIfDoneRendering')->once(); - - $view->renderable = m::mock(Renderable::class); - $view->renderable->shouldReceive('render')->once()->andReturn('text'); - $this->assertEquals('contents', $view->render()); - } - - - public function testViewRenderSections() - { - $view = $this->getView(); - $view->getFactory()->shouldReceive('incrementRender')->once()->ordered(); - $view->getFactory()->shouldReceive('callComposer')->once()->ordered()->with($view); - $view->getFactory()->shouldReceive('getShared')->once()->andReturn(['shared' => 'foo']); - $view->getEngine()->shouldReceive('get')->once()->andReturn('contents'); - $view->getFactory()->shouldReceive('decrementRender')->once()->ordered(); - $view->getFactory()->shouldReceive('flushStateIfDoneRendering')->once(); - - $view->getFactory()->shouldReceive('getSections')->once()->andReturn(['foo','bar']); - $sections = $view->renderSections(); - $this->assertEquals($sections[0], 'foo'); - $this->assertEquals($sections[1], 'bar'); - } - - - public function testWithErrors() - { - $view = $this->getView(); - $errors = ['foo' => 'bar', 'qu' => 'ux']; - $this->assertSame($view, $view->withErrors($errors)); - $this->assertInstanceOf(MessageBag::class, $view->errors); - $foo = $view->errors->get('foo'); - $this->assertEquals($foo[0], 'bar'); - $qu = $view->errors->get('qu'); - $this->assertEquals($qu[0], 'ux'); - $data = ['foo' => 'baz']; - $this->assertSame($view, $view->withErrors(new MessageBag($data))); - $foo = $view->errors->get('foo'); - $this->assertEquals($foo[0], 'baz'); - } - - - protected function getView() - { - return new View( - m::mock(Factory::class), - m::mock(EngineInterface::class), - 'view', - 'path', - ['foo' => 'bar'] - ); - } - -} diff --git a/tests/View/fixtures/basic.php b/tests/View/fixtures/basic.php deleted file mode 100755 index 557db03de..000000000 --- a/tests/View/fixtures/basic.php +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/tests/View/fixtures/namespaced/basic.php b/tests/View/fixtures/namespaced/basic.php deleted file mode 100755 index 557db03de..000000000 --- a/tests/View/fixtures/namespaced/basic.php +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/tests/View/fixtures/nested/basic.php b/tests/View/fixtures/nested/basic.php deleted file mode 100755 index 557db03de..000000000 --- a/tests/View/fixtures/nested/basic.php +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/tests/View/fixtures/nested/child.php b/tests/View/fixtures/nested/child.php deleted file mode 100755 index ce0b1ebdb..000000000 --- a/tests/View/fixtures/nested/child.php +++ /dev/null @@ -1 +0,0 @@ -Hello World diff --git a/tests/View/fixtures/section-exception-layout.php b/tests/View/fixtures/section-exception-layout.php deleted file mode 100644 index 7b3acd8b8..000000000 --- a/tests/View/fixtures/section-exception-layout.php +++ /dev/null @@ -1 +0,0 @@ -yieldContent('content'); ?> diff --git a/tests/View/fixtures/section-exception.php b/tests/View/fixtures/section-exception.php deleted file mode 100644 index 13a8c901c..000000000 --- a/tests/View/fixtures/section-exception.php +++ /dev/null @@ -1,4 +0,0 @@ -make('layout', array_except(get_defined_vars(), ['__data', '__path']))->render(); ?> -startSection('content'); ?> - -stopSection(); ?>