-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReceiptCodeTest.php
More file actions
33 lines (27 loc) · 1.11 KB
/
ReceiptCodeTest.php
File metadata and controls
33 lines (27 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
namespace Cable8mm\GoodCode\Tests;
use Cable8mm\GoodCode\ReceiptCode;
use PHPUnit\Framework\TestCase;
class ReceiptCodeTest extends TestCase
{
public function test_of_method()
{
$this->assertEquals('PO-20250312-0001', ReceiptCode::of('PO-20250312-0001')->code);
}
public function test_code_method()
{
$this->assertEquals('PO-20250312-0001', ReceiptCode::make()->code('PO-20250312-0001')->code);
$this->assertEquals('PO', ReceiptCode::make()->code('PO-20250312-0001')->prefix);
$this->assertEquals('20250312', ReceiptCode::make()->code('PO-20250312-0001')->ymd);
$this->assertEquals('0001', ReceiptCode::make()->code('PO-20250312-0001')->number);
}
public function test_next_code_method()
{
$this->assertEquals('PO-20250312-0002', ReceiptCode::make()->code('PO-20250312-0001')->nextCode());
$this->assertEquals('PO-20250312-10000', ReceiptCode::make()->code('PO-20250312-9999')->nextCode());
}
public function test_no_code()
{
$this->assertEquals('PO-'.date('Ymd').'-0001', ReceiptCode::make()->nextCode());
}
}