- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图在单元测试期间模拟 Laravel 中的一些外观,但似乎无论如何测试总是会通过。
例如,此示例取自 Laravel 文档:
Event::shouldReceive('fire')->once()->with('foo', array('name' => 'Dayle'));
看来我可以将其放入任何测试方法中,并且它们总是通过,即使没有对 Event
外观进行任何此类操作。
这是测试类:
class SessionsControllerTest
extends TestCase
{
public function test_invalid_login_returns_to_login_page()
{
// All of these pass even when they should fail
Notification::shouldReceive('error')->once()->with('Incorrect email or password.');
Event::shouldReceive('fire')->once()->with('foo', array('name' => 'Dayle'));
Notification::shouldReceive('nonsense')->once()->with('nonsense');
// Make login attempt with bad credentials
$this->post(action('SessionsController@postLogin'), [
'inputEmail' => 'bademail@example.com',
'inputPassword' => 'badpassword'
]);
// Should redirect back to login form with old input
$this->assertHasOldInput();
$this->assertRedirectedToAction('SessionsController@getLogin');
}
}
为了测试 Facades,我缺少什么?我是否认为我应该能够在任何 Laravel Facade 上调用 shouldReceive()
而无需任何设置?
最佳答案
您需要告诉mockery 运行它的验证。您可以通过放置来做到这一点
\Mockery::close();
在测试方法的末尾,或者在测试类的拆卸方法中。
或者,您可以通过将其添加到 phpunit.xml 来设置 mockery 的 phpunit 集成
<listeners>
<listener class="\Mockery\Adapter\Phpunit\TestListener"></listener>
</listeners>
参见http://docs.mockery.io/en/latest/reference/phpunit_integration.html欲了解更多信息。
关于php - 用 mock 测试 Laravel 外观总是会通过,即使它应该失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24028829/
您可以将自定义皮肤/外观应用于 SSMS 吗?我正在考虑类似于大多数 IDE 中的深色主题(黑色背景、黄色字体)的做法 最佳答案 我决定在 SSMS 2012 上尝试一些简单的操作: 转到http:/
WordPress主题开发中如何在外观部分显示菜单选项?我可以看到主题、自定义和编辑器选项。这段代码有什么问题- function pietergoosen_theme_setup() { reg
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 9 年前。 Improv
我正在我的一个项目中使用 JTabbedPane,并且我正在尝试更改应用程序的外观和感觉。当我设置窗口的外观和感觉(以及与此相关的任何其他外观和感觉)时,所有按钮、检查按钮等都会更改为它们应该的外观,
如何更改使用 SFAuthenticationSession 时显示的 SafariVC 上的tintColor 和 barTintColor? 我尝试更改 UINavigationBar 、 UIT
我想让 editText 看起来像这样: 设置editText的背景后我还应该做什么如何通过代码让文本在edittext中开始。 最佳答案 您是否想让 EditText 默认说“用户名”,但不是实际的
我在 didFinishLaunchingWithOptions 末尾使用以下代码 [[UITableViewHeaderFooterView Appearance] setTintColor:[UI
我的 ActionBar 中有 android.support.v7.widget.ShareActionProvider 菜单。 当我点击“分享”时,应用列表显示为弹出菜单。 当我在 Google
在使用 shiny 作为调查工具时,我想将 slider 用作“李克特式问题”。 因此,我想自定义 slider 末端的标题,使其有点像“我完全同意”和“我完全不同意”。有没有一种流畅的方法可以做到这
我正在阅读 Laravel 文档,试图更深入地了解该框架,但我在外观方面遇到了一些麻烦。我想我明白它们是什么,它们主要是为了方便访问 Laravel 核心而使用。 我对这个主题感到困惑: How do
我正在制作一款游戏,我想要一个用户可以填写表格提出想法或错误的地方,但希望它看起来与游戏图形/按钮等的其余部分相似。我不知道如何制作带图片的自定义文本字段。我希望最终结果如下所示: 我知道如何设置自定
我的 Storyboard中有多个 UINavigationController。由于我使用的是 tabbarcontroller,因此每个选项卡项都在其 ViewController 之前嵌入了自己
我需要创建一个外观,将请求转发到其他 Web 服务。 除了转发之外,外观只会对用户进行身份验证/授权。 实现这个的好方法是什么? 我曾经使用 Jersey,也许有比手动创建 WebTarget 更好的
我使用了 windows 安装程序(msi 项目),实际上我在安装后得到了 msi 文件,它会在桌面上显示一个快捷方式。 我的问题是,当我双击我的应用程序的快捷方式时,它会显示类似安装的内容,然后它会
我通过 trayIcon.displayMessage(...) 在系统托盘上显示消息,但它们看起来不太好。我试图将它们的外观更改为系统标准,但在创建图标之前调用 UIManager.setLookA
我正在尝试为我的应用程序应用深色主题,当我调用深色主题时遇到问题,代码在重新启动应用程序之前不起作用。我在设置 View Controller 中使用 UISwtich 调用黑暗模式。当我打开深色模式
我正在为我不拥有或无法访问其源代码的 Swing 应用程序编写插件。在我的部分 UI 中,我想使用特定的颜色来匹配我的图标。 在这种情况下,我想创建一个具有特定背景颜色的 JPanel。 final
这个问题已经有答案了: 已关闭12 年前。 Possible Duplicate: Look and feel in java 是否有第三方漂亮的 L&F for Java swing 应用程序?默认
我想要 JButton 的外观: 我尝试通过这种方式更改 Windows 的外观: UIManager.setLookAndFeel("com.sun.java.swing.plaf.window
是否可以更改 UITabBarController 的外观? 例如,将 tabBarItems 垂直(而不是水平)排列在 View 的中心(而不是锁定在底部) 最佳答案 对于你想要的改变,没有。 您所
我是一名优秀的程序员,十分优秀!