for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace tests;
use dominus77\sweetalert2\Alert;
use yii\helpers\Json;
/**
* Class AlertTest
* @package tests
*/
class AlertTest extends TestCase
{
* getOptions()
public function testGetOptions()
$alert = new Alert();
$alert->options = [
'id' => 'test_id',
'Any fool can use a computer'
];
$this->assertJson(Json::encode($alert->options), $alert->getOptions());
}
public function testRegisterSwalQueue()
\Yii::$app->session->setFlash('success', 'Your message');
$alert = Alert::widget(['useSessionFlash' => true]);
$this->assertContains('', $alert);
public function testRunFlash()
\Yii::$app->session->setFlash('success', [
[
'title' => 'Your title',
'message' => 'Your message',
'animation' => false,
'customClass' => 'animated jello',
]
]);
public function testRegisterSwal()
$alert = Alert::widget([
'options' => [
'customClass' => 'animated jello', // https://daneden.github.io/animate.css/
],