TDoG-Skin/vendor/blessing/rejection/tests/RejectionTest.php

29 lines
781 B
PHP
Raw Normal View History

2024-08-17 18:43:48 +08:00
<?php
namespace Tests;
use Blessing\Rejection;
use PHPUnit\Framework\TestCase;
class RejectionTest extends TestCase
{
public function testGetReason()
{
$reason = 'rejected';
$rejection = new Rejection($reason);
$this->assertEquals($reason, $rejection->getReason());
}
public function testGetData()
{
$rejection = new Rejection('', 'data');
$this->assertEquals('data', $rejection->getData());
$rejection = new Rejection('', ['a' => 'b']);
$this->assertEquals('b', $rejection->getData('a'));
$this->assertNull($rejection->getData('nope'));
$this->assertEquals('default', $rejection->getData('nope', 'default'));
$this->assertEquals(['a' => 'b'], $rejection->getData());
}
}