I want to test file uploading function in my module, but i stuck with limitation of is_uploaded_file and move_uploaded_file over CLI.
Trying to emulate user uploading files actions by crafting custom $_FILES array:
class Company_Module_Test_Helper_CompanyHelperTests extends EcomDev_PHPUnit_Test_Case {
public function uploadProductImagesTest() {
...
$this->assertTrue(file_exists($testFile));
$this->assertTrue(is_readable($testFile));
$_FILES = array(
...
);
$this->mockSession('customer/session');
$this->customerSession($fixtureCustomerId);
...
but when i debug, i see that move_uploaded_file in Varien_File_Uploader->_moveFile() function just return false.
I found solution to use custom namespace and override move_uploaded_file and is_uploaded_file function but when i tried to add custom namespace in test class the test won't run:
namespace CustomTest;
class Company_Module_Test_Helper_CompanyHelperTests extends \EcomDev_PHPUnit_Test_Case {
...
}
Need some advice in this case, maybe it is possible somehow ? Thanks