-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ANKUR DWIVEDI
authored and
ANKUR DWIVEDI
committed
Aug 23, 2024
1 parent
3e84921
commit 6313b8e
Showing
5 changed files
with
118 additions
and
6 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 |
---|---|---|
|
@@ -50,6 +50,7 @@ class ErrorMessages | |
public static $UPLOAD_FILE_PARAMETER_OPTIONS_INVALID_PRE_TRANSFORMATION = [ "message" => "Invalid pre transformation parameter.", "help" => "For support kindly contact us at [email protected] ."]; | ||
public static $UPLOAD_FILE_PARAMETER_OPTIONS_INVALID_POST_TRANSFORMATION = [ "message" => "Invalid post transformation parameter.", "help" => "For support kindly contact us at [email protected] ."]; | ||
public static $UPLOAD_FILE_PARAMETER_OPTIONS_INVALID_CHECKS = [ "message" => "The value provided for the checks parameter is invalid.", "help" => "For support kindly contact us at [email protected] ."]; | ||
public static $UPLOAD_FILE_PARAMETER_OPTIONS_INVALID_PUBLISH_STATUS = [ "message" => "isPublished must be boolean.", "help" => "For support kindly contact us at [email protected] ."]; | ||
public static $MISSING_UPLOAD_DATA = ['message' => 'Missing data for upload', 'help' => 'For support kindly contact us at [email protected] .']; | ||
public static $MISSING_UPLOAD_FILE_PARAMETER = ['message' => 'Missing file parameter for upload', 'help' => 'For support kindly contact us at [email protected] .']; | ||
public static $MISSING_UPLOAD_FILENAME_PARAMETER = ['message' => 'Missing fileName parameter for upload', 'help' => 'For support kindly contact us at [email protected] .']; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,7 +172,8 @@ public function testFileUploadIfSuccessful() | |
] | ||
] | ||
], | ||
'checks' => "'request.folder' : '/sample-folder'" | ||
'checks' => "'request.folder' : '/sample-folder'", | ||
'isPublished' => true | ||
]; | ||
|
||
$mockBodyResponse = Utils::streamFor(json_encode($this->uploadSuccessResponseObj)); | ||
|
@@ -217,6 +218,7 @@ public function testFileUploadIfSuccessful() | |
$this->checkFormData($stream,$boundary,"customMetadata",json_encode($fileOptions['customMetadata'])); | ||
$this->checkFormData($stream,$boundary,"transformation",json_encode($fileOptions['transformation'])); | ||
$this->checkFormData($stream,$boundary,"checks",$fileOptions['checks']); | ||
$this->checkFormData($stream,$boundary,"isPublished","true"); | ||
|
||
// Assert Method | ||
$requestMethod = $container[0]['request']->getMethod(); | ||
|
@@ -814,6 +816,29 @@ public function testFileUploadWithInvalidChecks() | |
UploadTest::assertEquals(json_encode($error),json_encode($response->error)); | ||
} | ||
|
||
public function testFileUploadWithInvalidPublishStatus() | ||
{ | ||
$fileOptions = [ | ||
'file' => 'http://lorempixel.com/640/480/', | ||
'fileName' => 'test_file_name', | ||
"useUniqueFileName" => true, // true|false | ||
"responseFields" => implode(",", ["tags", "customMetadata"]), // Comma Separated, check docs for more responseFields | ||
'isPublished' => '' | ||
]; | ||
|
||
$error = [ | ||
"message" => "isPublished must be boolean.", | ||
"help" => "For support kindly contact us at [email protected] ." | ||
]; | ||
|
||
$this->stubHttpClient(new Response(403, ['X-Foo' => 'Bar'], json_encode($error))); | ||
|
||
$response = $this->client->uploadFile($fileOptions); | ||
|
||
// Request Body Check | ||
UploadTest::assertEquals(json_encode($error),json_encode($response->error)); | ||
} | ||
|
||
protected function setUp() | ||
{ | ||
$this->client = new ImageKit( | ||
|