File: tests/Unit/Gtid/GtidTest.php

Recommend this page to a friend!
  Classes of Kacper Rowinski  >  PHP MySQL Replication  >  tests/Unit/Gtid/GtidTest.php  >  Download  
File: tests/Unit/Gtid/GtidTest.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: 1 year ago
Size: 1,307 bytes
 

 

Contents

Class file image Download
<?php

namespace MySQLReplication\Tests\Unit\Gtid;

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

class
GtidTest extends BaseTest
{
    private function
getGtid(string $data): Gtid
   
{
        return new
Gtid($data);
    }

   
/**
     * @test
     */
   
public function shouldGetEncoded()
    {
       
$this->assertSame('9b1c8d182a7611e5a26b000c2976f3f301000000000000000100000000000000b8b5020000000000', bin2hex($this->getGtid('9b1c8d18-2a76-11e5-a26b-000c2976f3f3:1-177592')->getEncoded()));
       
$this->assertSame('9b1c8d182a7611e5a26b000c2976f3f3010000000000000001000000000000000200000000000000', bin2hex($this->getGtid('9b1c8d18-2a76-11e5-a26b-000c2976f3f3:1')->getEncoded()));
    }

   
/**
     * @test
     */
   
public function shouldGetEncodedLength()
    {
       
$this->assertSame(40, $this->getGtid('9b1c8d18-2a76-11e5-a26b-000c2976f3f3:1-177592')->getEncodedLength());
    }

   
/**
     * @test
     */
   
public function shouldThrowErrorOnIncrrectGtid()
    {
       
$this->expectException(GtidException::class);
       
$this->expectExceptionMessage(GtidException::INCORRECT_GTID_MESSAGE);
       
$this->expectExceptionCode(GtidException::INCORRECT_GTID_CODE);

       
$this->getGtid('not gtid');
    }
}


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