我想在我们的页面上添加对flash消息的支持.我按照此处的文档实现了这一点.
我将以下snipplet添加到我的基本布局中.(我也尝试将其添加到特定的操作模板中).
{% if app.session.hasFlash('notice') %}
<div id="flashmessage" class="flash-notice">
{{ app.session.flash('notice') }}
</div>
{% endif %}
Run Code Online (Sandbox Code Playgroud)
添加以下错误后抛出
Twig_Error_Runtime:第66行"MyBundle :: layout.html.twig"中不存在""的"hasFlash"项
还有什么我需要做的吗?
我使用 phpunit 的 testsuites 功能来组织我的测试。我这样做是为了以后能够并行运行测试。
对于不同的目录,这相对简单。因此,例如,我可以通过捆绑来拆分测试套件。
<testsuite name="bundle-one">
<directory>tests/BundleOne</directory>
</testsuite>
<testsuite name="bundle-two">
<directory>tests/BundleTwo</directory>
</testsuite>
<testsuite name="bundle-three">
<directory>tests/BundleThree</directory>
</testsuite>
Run Code Online (Sandbox Code Playgroud)
但是现在我有一个包含数十个子文件夹的目录(服务)。我可以手动为这个文件夹制作几个测试套件。但在我看来,这将是一个薄弱的解决方案。因为如果我提到测试套件中的每个子文件夹并且文件夹被重命名或删除,测试套件可能很容易损坏。
我的想法是使用某种正则表达式来选择一系列子文件夹以包含在一个测试套件中,并为另一个测试套件选择另一范围的文件夹。
<testsuite name="services-AM">
<directory>tests/services/{A-M}</directory>
</testsuite>
<testsuite name="services-NZ">
<directory>tests/services/{A-M}</directory>
</testsuite>
Run Code Online (Sandbox Code Playgroud)
我找不到任何关于我的想法的文档。有人可能对此有想法吗?:-)