mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-21 13:23:04 +01:00
60 lines
1.6 KiB
PHP
60 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Helpers\NotificationsHelper;
|
|
|
|
use App\Helpers\NotificationsHelper;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Foundation\Testing\WithFaker;
|
|
use Tests\TestCase;
|
|
|
|
class ThresholdMessageTest extends TestCase
|
|
{
|
|
/**
|
|
* Test absolute message
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testAbsoluteMessageMultiField()
|
|
{
|
|
$msg = NotificationsHelper::formatAbsoluteThresholdMessage([ 'ping', 'upload' ]);
|
|
|
|
$this->assertEquals('For the latest speedtest, the ping, upload values exceeded the absolute threshold', $msg);
|
|
}
|
|
|
|
/**
|
|
* Test absolute message
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testAbsoluteMessageSingleField()
|
|
{
|
|
$msg = NotificationsHelper::formatAbsoluteThresholdMessage([ 'ping' ]);
|
|
|
|
$this->assertEquals('For the latest speedtest, the ping value exceeded the absolute threshold', $msg);
|
|
}
|
|
|
|
/**
|
|
* Test absolute message
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testPercentageMessageMultiField()
|
|
{
|
|
$msg = NotificationsHelper::formatPercentageThresholdMessage([ 'ping', 'upload' ]);
|
|
|
|
$this->assertEquals('For the latest speedtest, the ping, upload values exceeded the percentage threshold', $msg);
|
|
}
|
|
|
|
/**
|
|
* Test absolute message
|
|
*
|
|
* @return void
|
|
*/
|
|
public function testPercentageMessageSingleField()
|
|
{
|
|
$msg = NotificationsHelper::formatPercentageThresholdMessage([ 'ping' ]);
|
|
|
|
$this->assertEquals('For the latest speedtest, the ping value exceeded the percentage threshold', $msg);
|
|
}
|
|
}
|