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: Feature/php71 (#53)

- Removed: support for lesser then php7
- Added: strong and string types
- Changed: ConfigFactory removed and method make form array moved to Config
- Changed: MariaDbGtidLogDTO replaced getSequenceNumber with getMariaDbGtid
- Fixed: Insert NULL in a boolean column returns no rows
- Fixed: float problem about time field type
- Fixed: column order
- Changed: getFields and getMasterStatus returns no VO
- Changed: Column to ColumnDTO and added ColumnDTOCollection
- Changed: replaced getFields with getColumnDTOCollection in TableMap
- Added: more compatibility for mysql 5.5, 5.6, 5.7, maria 10 and 8.0
- Removed: makeConfigFromArray
Date: 9 months ago
Size: 1,515 bytes
 

Contents

Class file image Download
<?php

namespace MySQLReplication\Tests\Unit\Gtid;

use
MySQLReplication\Gtid\Gtid;
use
MySQLReplication\Gtid\GtidCollection;
use
MySQLReplication\Gtid\GtidException;
use
MySQLReplication\Gtid\GtidFactory;
use
MySQLReplication\Tests\Unit\BaseTest;

/**
 * Class GtidCollectionTest
 * @package Unit\Gtid
 */
class GtidCollectionTest extends BaseTest
{
   
/**
     * @var GtidCollection
     */
   
private $gtidCollection;

   
/**
     * @throws GtidException
     */
   
public function setUp()
    {
       
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'));
    }

   
/**
     * @test
     */
   
public function shouldGetEncodedLength(): void
   
{
       
$this->assertSame(88, $this->gtidCollection->getEncodedLength());
    }

   
/**
     * @test
     */
   
public function shouldGetEncoded(): void
   
{
       
$this->assertSame('02000000000000009b1c8d182a7611e5a26b000c2976f3f301000000000000000100000000000000b8b5020000000000bbbbbbbbccccffffddddaaaaaaaaaaaa010000000000000001000000000000000200000000000000', bin2hex($this->gtidCollection->getEncoded()));
    }

   
/**
     * @test
     */
   
public function shouldCreateCollection()
    {
       
$this->assertInstanceOf(GtidCollection::class, GtidCollection::makeCollectionFromString('9b1c8d18-2a76-11e5-a26b-000c2976f3f3:1-177592'));
    }
}


For more information send a message to info at phpclasses dot org.