/** @test */ public function it_flashes_config_for_a_info_alert() { $session = m::mock(SessionStore::class); $notifier = new SweetAlertNotifier($session); $expectedConfig = ['timer' => 1800, 'title' => 'Alert', 'text' => 'Info Alert!', 'showConfirmButton' => false, 'type' => 'info']; $expectedJsonConfig = json_encode($expectedConfig); $session->shouldReceive('flash')->with('sweet_alert.timer', $expectedConfig['timer']); $session->shouldReceive('flash')->with('sweet_alert.showConfirmButton', $expectedConfig['showConfirmButton']); $session->shouldReceive('flash')->with('sweet_alert.title', $expectedConfig['title']); $session->shouldReceive('flash')->with('sweet_alert.text', $expectedConfig['text']); $session->shouldReceive('flash')->with('sweet_alert.type', $expectedConfig['type']); $session->shouldReceive('flash')->with('sweet_alert.alert', $expectedJsonConfig); $notifier->info('Info Alert!', 'Alert'); $this->assertEquals($expectedConfig, $notifier->getConfig()); $this->assertEquals($expectedJsonConfig, $notifier->getJsonConfig()); }
/** * Display an info 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 info($text, $title = '') { return \UxWeb\SweetAlert\SweetAlertNotifier::info($text, $title); }