success() 공개 메소드

Display a success typed alert message with a text and an optional title.
public success ( string $text, string $title = '' ) : SweetAlertNotifier
$text string
$title string
리턴 SweetAlertNotifier $this
예제 #1
0
 /** @test */
 public function it_flashes_config_for_a_success_alert()
 {
     $session = m::mock(SessionStore::class);
     $notifier = new SweetAlertNotifier($session);
     $expectedConfig = ['timer' => 1800, 'title' => 'Success!', 'text' => 'Well Done!', 'showConfirmButton' => false, 'type' => 'success'];
     $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->success('Well Done!', 'Success!');
     $this->assertEquals($expectedConfig, $notifier->getConfig());
     $this->assertEquals($expectedJsonConfig, $notifier->getJsonConfig());
 }
예제 #2
0
 /**
  * Display a success 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 success($text, $title = '')
 {
     return \UxWeb\SweetAlert\SweetAlertNotifier::success($text, $title);
 }