packages/sql-semantics-mysql/tests/Unit/Statement/Server/Transaction/Xa/XidTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Server\Transaction\Xa;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Semantics;
11use SqlSemantics\Platform\MySql\Statement\Literal\Text;
12use SqlSemantics\Platform\MySql\Statement\Server\Transaction\Xa\Xid;
13
14#[CoversClass(Xid::class)]
15#[Medium]
16final class XidTest extends TestCase
17{
18 public function testRenderWritesThePartsSeparatedByCommas(): void
19 {
20 self::assertSame("XA START 'g', b'1', x'7fffffffffffffff'", (new Semantics())->analyze("xa start 'g', b'1', 0x7fffffffffffffff")->toString());
21 }
22
23 public function testTransactionIsTheFirstPart(): void
24 {
25 self::assertSame('g', (new Xid(new Text('g')))->transaction->value);
26 }
27}
28