diff --git a/src/Support/Str.php b/src/Support/Str.php index 6e32c05d..04f4b1fd 100644 --- a/src/Support/Str.php +++ b/src/Support/Str.php @@ -79,7 +79,7 @@ final class Str return $subject; } - return substr($subject, 0, $pos); + return mb_substr($subject, 0, $pos); } /** diff --git a/tests/.snapshots/SuccessOnly.php.inc b/tests/.snapshots/SuccessOnly.php.inc index b00a0e36..b940b7b6 100644 --- a/tests/.snapshots/SuccessOnly.php.inc +++ b/tests/.snapshots/SuccessOnly.php.inc @@ -1,5 +1,5 @@ ##teamcity[testSuiteStarted name='Tests/tests/SuccessOnly' locationHint='pest_qn://tests/.tests/SuccessOnly.php' flowId='1234'] -##teamcity[testCount count='3' flowId='1234'] +##teamcity[testCount count='4' flowId='1234'] ##teamcity[testStarted name='it can pass with comparison' locationHint='pest_qn://tests/.tests/SuccessOnly.php::it can pass with comparison' flowId='1234'] ##teamcity[testFinished name='it can pass with comparison' duration='100000' flowId='1234'] ##teamcity[testStarted name='can also pass' locationHint='pest_qn://tests/.tests/SuccessOnly.php::can also pass' flowId='1234'] @@ -8,8 +8,12 @@ ##teamcity[testStarted name='can pass with dataset with data set "(true)"' locationHint='pest_qn://tests/.tests/SuccessOnly.php::can pass with dataset with data set "(true)"' flowId='1234'] ##teamcity[testFinished name='can pass with dataset with data set "(true)"' duration='100000' flowId='1234'] ##teamcity[testSuiteFinished name='can pass with dataset' flowId='1234'] +##teamcity[testSuiteStarted name='`block` → can pass with dataset in describe block' locationHint='pest_qn://tests/.tests/SuccessOnly.php::`block` → can pass with dataset in describe block' flowId='1234'] +##teamcity[testStarted name='`block` → can pass with dataset in describe block with data set "(1)"' locationHint='pest_qn://tests/.tests/SuccessOnly.php::`block` → can pass with dataset in describe block with data set "(1)"' flowId='1234'] +##teamcity[testFinished name='`block` → can pass with dataset in describe block with data set "(1)"' duration='100000' flowId='1234'] +##teamcity[testSuiteFinished name='`block` → can pass with dataset in describe block' flowId='1234'] ##teamcity[testSuiteFinished name='Tests/tests/SuccessOnly' flowId='1234'] - Tests: 3 passed (3 assertions) + Tests: 4 passed (4 assertions) Duration: 1.00s diff --git a/tests/.tests/SuccessOnly.php b/tests/.tests/SuccessOnly.php index cb4009a6..4d231a8d 100644 --- a/tests/.tests/SuccessOnly.php +++ b/tests/.tests/SuccessOnly.php @@ -13,3 +13,9 @@ test('can also pass', function () { test('can pass with dataset', function ($value) { expect($value)->toEqual(true); })->with([true]); + +describe('block', function () { + test('can pass with dataset in describe block', function ($number) { + expect($number)->toBeInt(); + })->with([1]); +}); diff --git a/tests/Visual/JUnit.php b/tests/Visual/JUnit.php index 3523bdd6..fd34ea7a 100644 --- a/tests/Visual/JUnit.php +++ b/tests/Visual/JUnit.php @@ -36,8 +36,8 @@ test('junit output', function () use ($normalizedPath, $run) { expect($result['testsuite']['@attributes']) ->name->toBe('Tests\tests\SuccessOnly') ->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php')) - ->tests->toBe('3') - ->assertions->toBe('3') + ->tests->toBe('4') + ->assertions->toBe('4') ->errors->toBe('0') ->failures->toBe('0') ->skipped->toBe('0');