1*8817535bSAndreas Gohr<?php 2*8817535bSAndreas Gohr 3*8817535bSAndreas Gohrnamespace Vanderlee\Sentence\Tests; 4*8817535bSAndreas Gohr 5*8817535bSAndreas Gohruse Vanderlee\Sentence\Multibyte; 6*8817535bSAndreas Gohr 7*8817535bSAndreas Gohrclass MultibyteTest extends \PHPUnit_Framework_TestCase 8*8817535bSAndreas Gohr{ 9*8817535bSAndreas Gohr 10*8817535bSAndreas Gohr /** 11*8817535bSAndreas Gohr * @covers Sentence::count 12*8817535bSAndreas Gohr * @dataProvider dataSplit 13*8817535bSAndreas Gohr */ 14*8817535bSAndreas Gohr public function testSplit($expected, $pattern, $subject, $limit = -1, $flags = 0) 15*8817535bSAndreas Gohr { 16*8817535bSAndreas Gohr $this->assertSame($expected, Multibyte::split($pattern, $subject, $limit, $flags)); 17*8817535bSAndreas Gohr } 18*8817535bSAndreas Gohr 19*8817535bSAndreas Gohr public function dataSplit() 20*8817535bSAndreas Gohr { 21*8817535bSAndreas Gohr return [ 22*8817535bSAndreas Gohr [['a', 'b', 'c'], '-', 'a-b-c'], 23*8817535bSAndreas Gohr [['a', 'b', 'c'], '-', 'a-b-c', 3], 24*8817535bSAndreas Gohr [['a', 'b', 'c'], '-', 'a-b-c', -1], 25*8817535bSAndreas Gohr [['a', 'b-c'], '-', 'a-b-c', 2], 26*8817535bSAndreas Gohr [['a-b-c'], '-', 'a-b-c', 1], 27*8817535bSAndreas Gohr [['a', 'b', 'c'], '-', 'a-b-c', -1, PREG_SPLIT_DELIM_CAPTURE], 28*8817535bSAndreas Gohr [['a', '-', 'b', '-', 'c'], '(-)', 'a-b-c', -1, PREG_SPLIT_DELIM_CAPTURE], 29*8817535bSAndreas Gohr ]; 30*8817535bSAndreas Gohr } 31*8817535bSAndreas Gohr} 32