/** @test */ public function it_flashes_config_for_a_warning_alert() { $session = m::mock(SessionStore::class); $notifier = new SweetAlertNotifier($session); $expectedConfig = ['timer' => 1800, 'title' => 'Watch Out!', 'text' => 'Hey cowboy!', 'showConfirmButton' => false, 'type' => 'warning']; $expectedJsonConfig = json_encode($expectedConfig); $session->shouldReceive('flash')->with('sweet_alert.timer', $expectedConfig['timer']); $session->shouldReceive('flash')->with('sweet_alert.title', $expectedConfig['title']); $session->shouldReceive('flash')->with('sweet_alert.text', $expectedConfig['text']); $session->shouldReceive('flash')->with('sweet_alert.showConfirmButton', $expectedConfig['showConfirmButton']); $session->shouldReceive('flash')->with('sweet_alert.type', $expectedConfig['type']); $session->shouldReceive('flash')->with('sweet_alert.alert', $expectedJsonConfig); $notifier->warning('Hey cowboy!', 'Watch Out!'); $this->assertEquals($expectedConfig, $notifier->getConfig()); $this->assertEquals($expectedJsonConfig, $notifier->getJsonConfig()); }
/** * Display a warning typed alert message with a text and an optional title. * * @param string $text * @param string $title * @return \UxWeb\SweetAlert\SweetAlertNotifier $this * @static */ public static function warning($text, $title = '') { return \UxWeb\SweetAlert\SweetAlertNotifier::warning($text, $title); }