-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More tests, specifically with chosen_inline_result
- Loading branch information
Showing
6 changed files
with
110 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace tests\InternalFunctionality; | ||
|
||
use unreal4u\InternalFunctionality\FormConstructor; | ||
|
||
class FormConstructorTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var FormConstructor | ||
*/ | ||
private $formConstructor; | ||
|
||
/** | ||
* Prepares the environment before running a test. | ||
*/ | ||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->formConstructor = new FormConstructor(); | ||
} | ||
|
||
/** | ||
* Cleans up the environment after running a test. | ||
*/ | ||
protected function tearDown() | ||
{ | ||
$this->formConstructor = null; | ||
parent::tearDown(); | ||
} | ||
|
||
public function providerBuildMultipartFormData() | ||
{ | ||
$mapValues[] = [ | ||
[ | ||
'id' => 'lala', | ||
'contents' => 'lolo', | ||
], | ||
'non-existant', | ||
null, | ||
[ | ||
'multipart' => [ | ||
0 => [ | ||
'name' => 'id', | ||
'contents' => 'lala', | ||
], | ||
1 => [ | ||
'name' => 'contents', | ||
'contents' => 'lolo', | ||
] | ||
] | ||
], | ||
]; | ||
|
||
$mapValues[] = [[], '', null, ['multipart' => [],]]; | ||
|
||
return $mapValues; | ||
} | ||
|
||
/** | ||
* @dataProvider providerBuildMultipartFormData | ||
*/ | ||
public function testBuildMultipartFormData(array $data, string $fileKeyName, $stream = null, array $expected = []) | ||
{ | ||
$result = $this->formConstructor->buildMultipartFormData($data, $fileKeyName, $stream); | ||
$this->assertEquals($expected, $result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters