Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.6] Yet another blade helper @dump #22294

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Illuminate/View/Compilers/BladeCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BladeCompiler extends Compiler implements CompilerInterface
Concerns\CompilesComponents,
Concerns\CompilesConditionals,
Concerns\CompilesEchos,
Concerns\CompilesFormHelpers,
Concerns\CompilesHelpers,
Concerns\CompilesIncludes,
Concerns\CompilesInjections,
Concerns\CompilesJson,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Illuminate\View\Compilers\Concerns;

trait CompilesFormHelpers
trait CompilesHelpers
{
/**
* Compile the CSRF statements into valid PHP.
Expand All @@ -24,4 +24,15 @@ protected function compileMethod($method)
{
return "<?php echo method_field{$method}; ?>";
}

/*
* Compile the dump helper statements into valid PHP.
*
* @param string $args
* @return string
*/
protected function compileDump($args)
{
return "<?php dump{$args}; ?>";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

namespace Illuminate\Tests\View\Blade;

class BladeFormHelpersTest extends AbstractBladeTestCase
class BladeHelpersTest extends AbstractBladeTestCase
{
public function testEchosAreCompiled()
{
$this->assertEquals('<?php echo csrf_field(); ?>', $this->compiler->compileString('@csrf'));
$this->assertEquals('<?php echo method_field(\'patch\'); ?>', $this->compiler->compileString("@method('patch')"));
}

public function testDumpStatementsAreCompiled()
{
$this->assertEquals('<?php dump($foo); ?>', $this->compiler->compileString('@dump($foo)'));
$this->assertEquals('<?php dump($foo, $bar); ?>', $this->compiler->compileString('@dump($foo, $bar)'));
}
}