【发布时间】:2016-01-16 18:10:00
【问题描述】:
我有一个这样写的视图作曲家
view()->composer('masterbox.partials.pipeline', function($view) {
// Some vars and code
});
在我的一个观点中,我会这样做
@include('masterbox.partials.pipeline', ['my_var' => 1])
当我在浏览器上尝试时,一切都很好,但是当我运行一个简单的测试时,一切都崩溃了……经过一些调试,我发现闭包根本没有执行。
$this->visit('/connect/customer/subscribe')
->type($faker->firstName, 'first_name')
->type($faker->firstName, 'first_name')
->type($faker->lastName, 'last_name')
->type($faker->email, 'email')
->type($faker->phoneNumber, 'phone')
->type($password, 'password')
->type($password, 'password_confirmation')
->press("S'inscrire");
注意:它访问一个页面,填写表单并订阅,然后它重定向到带有@include的页面,它返回一个大错误,部分是
exception 'ErrorException' with message 'Undefined variable: my_var' in /Users/Loschcode/Google Drive/projects/my_project_lo/website/storage/framework/views/7e11f284c02bc38adc60b5f8a0545df65d7cf5ec.php:7
恐怕这是个问题,这是我几天前下载的新 Laravel 5.2。有什么猜测吗?有什么方法可以调试吗?谢谢
【问题讨论】:
标签: php unit-testing laravel-5 functional-testing