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