SoapServer/Client now handle binary files correctly & large tests/fixtures update

Soap Server and Client were breaking binary files during transfer due to invalid Mime Message Parser. Now is it working fine with no errors, but the message parser is about to be rewritten into a better form.
This commit is contained in:
Petr Bechyně
2017-04-04 18:36:18 +02:00
parent 311f9e6d08
commit 564005da93
42 changed files with 1135 additions and 250 deletions

View File

@ -0,0 +1,75 @@
<?php
namespace BeSimple\SoapCommon\Mime\Boundary;
use PHPUnit_Framework_TestCase;
class MimeBoundaryAnalyserTest extends PHPUnit_Framework_TestCase
{
const EXPECTED_HAS_BOUNDARY = true;
const EXPECTED_HAS_NO_BOUNDARY = false;
const EXPECTED_IS_BOUNDARY = true;
const EXPECTED_IS_NOT_BOUNDARY = false;
/**
* @dataProvider mimeMessageLinesDataProvider
* @param string[] $mimeMessageLines
* @param bool $expectHasBoundary
*/
public function testHasMessageBoundary(array $mimeMessageLines, $expectHasBoundary)
{
$hasMessageBoundary = MimeBoundaryAnalyser::hasMessageBoundary($mimeMessageLines);
self::assertEquals($expectHasBoundary, $hasMessageBoundary);
}
/**
* @dataProvider mimeMessageLineDataProvider
* @param string $mimeMessageLine
* @param bool $expectIsBoundary
*/
public function testIsMessageLineBoundary($mimeMessageLine, $expectIsBoundary)
{
$isMessageBoundary = MimeBoundaryAnalyser::isMessageLineBoundary($mimeMessageLine);
self::assertEquals($expectIsBoundary, $isMessageBoundary);
}
public function mimeMessageLinesDataProvider()
{
return [
[
[
'',
'mesage line -- has no boundary',
'-- this line is a boundary',
'',
'',
'-- this line is also a boundary --',
' -- this is not a boundary'
],
self::EXPECTED_HAS_BOUNDARY
],
[
[
'',
'mesage line -- has no boundary',
'',
'',
' -- this is not a boundary'
],
self::EXPECTED_HAS_NO_BOUNDARY
]
];
}
public function mimeMessageLineDataProvider()
{
return [
['-- this line is boundary', self::EXPECTED_IS_BOUNDARY],
['-- this line is also a boundary --', self::EXPECTED_IS_BOUNDARY],
['mesage line -- is not boundary', self::EXPECTED_IS_NOT_BOUNDARY],
[' -- mesage line -- is not boundary', self::EXPECTED_IS_NOT_BOUNDARY],
];
}
}