PHP Classes

File: tests/Unit/Gtid/GtidCollectionTest.php

Recommend this page to a friend!
  Classes of Kacper Rowinski   PHP MySQL Replication   tests/Unit/Gtid/GtidCollectionTest.php   Download  
File: tests/Unit/Gtid/GtidCollectionTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: PHP MySQL Replication
Client to get MySQL replication events in pure PHP
Author: By
Last change: New release (#104)

* - Change: drop support for < 8.2
- Change: moved to enums, promoted properties
- Added: logger for more socket info
- Added: slave_uuid support
- Change: config no longer static
- Chore: typos in README/code
- Chore: replace/remove old urls from code
- Chore: changed variables to underscore
- Added: support caching_sha2_password
- Change: BinLogServerInfo static calls removed also added method getServerInfo to MySQLReplicationFactory
Date: 11 days ago
Size: 1,267 bytes
 

 

Contents

Class file image Download
<?php

declare(strict_types=1);

namespace
MySQLReplication\Tests\Unit\Gtid;

use
MySQLReplication\Gtid\Gtid;
use
MySQLReplication\Gtid\GtidCollection;
use
PHPUnit\Framework\TestCase;

class
GtidCollectionTest extends TestCase
{
    private
GtidCollection $gtidCollection;

    protected function
setUp(): void
   
{
       
parent::setUp();

       
$this->gtidCollection = new GtidCollection();

       
$this->gtidCollection->add(new Gtid('9b1c8d18-2a76-11e5-a26b-000c2976f3f3:1-177592'));
       
$this->gtidCollection->add(new Gtid('BBBBBBBB-CCCC-FFFF-DDDD-AAAAAAAAAAAA:1'));
    }

    public function
testShouldGetEncodedLength(): void
   
{
       
self::assertSame(88, $this->gtidCollection->getEncodedLength());
    }

    public function
testShouldGetEncoded(): void
   
{
       
self::assertSame(
           
'02000000000000009b1c8d182a7611e5a26b000c2976f3f301000000000000000100000000000000b8b5020000000000bbbbbbbbccccffffddddaaaaaaaaaaaa010000000000000001000000000000000200000000000000',
           
bin2hex($this->gtidCollection->getEncoded())
        );
    }

    public function
testShouldCreateCollection(): void
   
{
       
self::assertCount(1, GtidCollection::makeCollectionFromString('9b1c8d18-2a76-11e5-a26b-000c2976f3f3:1-177592'));
    }
}