Skip to content

Commit 8c1035b

Browse files
authored
Merge pull request #12 from ehibes/master
Update string assert function
2 parents b804820 + 9b2b33c commit 8c1035b

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

Diff for: composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
},
2727
"require-dev": {
2828
"php-http/guzzle7-adapter": "^1.0",
29-
"phpunit/phpunit": "^8.0|^9.0"
29+
"phpunit/phpunit": "^8.0|^9.0",
30+
"php-http/message-factory": "^1.1"
3031
},
3132
"autoload": {
3233
"psr-4": {

Diff for: src/Api/Options/Assert.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function string(int $max, bool $required = false): callable
4747
return false;
4848
}
4949

50-
$length = strlen($value);
50+
$length = mb_strlen($value);
5151

5252
return (1 <= $length) && ($length <= $max);
5353
};

Diff for: tests/Api/ApiTest.php

+28
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,32 @@ private function createApi($mode = Api::MODE_PRODUCTION)
173173

174174
return $api;
175175
}
176+
177+
public function test_create_payment_form_with_accents_in_address()
178+
{
179+
$api = $this->createApi();
180+
181+
$result = $api->createPaymentForm([
182+
'date' => '17/03/2018:10:40:10',
183+
'amount' => '24.80',
184+
'currency' => 'EUR',
185+
'reference' => '100008783',
186+
'comment' => 'Commande 100008783',
187+
'locale' => 'FR',
188+
'email' => 'test@example.org',
189+
'success_url' => 'http://example.org',
190+
'failure_url' => 'http://example.org',
191+
'context' => [
192+
'billing' => [
193+
'addressLine1' => 'ïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïï',
194+
'city' => 'some city',
195+
'postalCode' => '12345',
196+
'country' => 'US',
197+
'stateOrProvince' => 'US-CA',
198+
],
199+
],
200+
]);
201+
202+
$this->assertIsArray($result);
203+
}
176204
}

0 commit comments

Comments
 (0)