@@ -26,14 +26,22 @@ public function setUp()
26
26
function testGethttpuploadoffsetAction ()
27
27
{
28
28
$ this ->setupDatabase (array ('default ' ));
29
- $ identifier = BASE_PATH .'/tmp/misc/httpupload.png ' ;
29
+
30
+ $ usersFile = $ this ->loadData ('User ' , 'default ' );
31
+ $ userDao = $ this ->User ->load ($ usersFile [0 ]->getKey ());
32
+ $ dir = BASE_PATH .'/tmp/misc/ ' .$ userDao ->getUserId ().'/ ' .$ userDao ->getPrivatefolderId ();
33
+ $ identifier = $ dir .'/httpupload.png ' ;
34
+ if (!file_exists ($ dir ))
35
+ {
36
+ mkdir ($ dir , 0700 , true );
37
+ }
30
38
if (file_exists ($ identifier ))
31
39
{
32
40
unlink ($ identifier );
33
41
}
34
42
copy (BASE_PATH .'/tests/testfiles/search.png ' , $ identifier );
35
- $ page = 'upload/gethttpuploadoffset/?uploadUniqueIdentifier=httpupload.png&testingmode=1 ' ;
36
- $ this ->dispatchUrI ($ page );
43
+ $ page = 'upload/gethttpuploadoffset/?uploadUniqueIdentifier= ' . $ userDao -> getUserId (). ' / ' . $ userDao -> getPrivatefolderId (). ' / httpupload.png&testingmode=1 ' ;
44
+ $ this ->dispatchUrI ($ page, $ userDao );
37
45
38
46
$ content = $ this ->getBody ();
39
47
if (strpos ($ content , '[OK] ' ) === false )
@@ -50,14 +58,17 @@ function testGethttpuploadoffsetAction()
50
58
function testGethttpuploaduniqueidentifierAction ()
51
59
{
52
60
$ this ->setupDatabase (array ('default ' ));
61
+
62
+ $ usersFile = $ this ->loadData ('User ' , 'default ' );
63
+ $ userDao = $ this ->User ->load ($ usersFile [0 ]->getKey ());
53
64
$ identifier = BASE_PATH .'/tmp/misc/httpupload.png ' ;
54
65
if (file_exists ($ identifier ))
55
66
{
56
67
unlink ($ identifier );
57
68
}
58
69
copy (BASE_PATH .'/tests/testfiles/search.png ' , $ identifier );
59
70
$ page = 'upload/gethttpuploaduniqueidentifier/?filename=httpupload.png&testingmode=1 ' ;
60
- $ this ->dispatchUrI ($ page );
71
+ $ this ->dispatchUrI ($ page, $ userDao );
61
72
$ content = $ this ->getBody ();
62
73
if (strpos ($ content , '[OK] ' ) === false )
63
74
{
@@ -73,9 +84,14 @@ function testGethttpuploaduniqueidentifierAction()
73
84
function testProcessjavauploadAction ()
74
85
{
75
86
$ this ->setupDatabase (array ('default ' ));
87
+
88
+ $ usersFile = $ this ->loadData ('User ' , 'default ' );
89
+ $ userDao = $ this ->User ->load ($ usersFile [0 ]->getKey ());
90
+ $ subdir = $ userDao ->getUserId ().'/ ' .$ userDao ->getPrivatefolderId ();
91
+ $ dir = BASE_PATH .'/tmp/misc/ ' .$ subdir ;
76
92
$ fileBase = BASE_PATH .'/tests/testfiles/search.png ' ;
77
93
$ file = BASE_PATH .'/tmp/misc/testing_file.png ' ;
78
- $ identifier = BASE_PATH . ' /tmp/misc /httpupload.png ' ;
94
+ $ identifier = $ dir . ' /httpupload.png ' ;
79
95
80
96
if (file_exists ($ identifier ))
81
97
{
@@ -87,13 +103,8 @@ function testProcessjavauploadAction()
87
103
fclose ($ ident );
88
104
chmod ($ identifier , 0777 );
89
105
90
- $ params = 'testingmode=1&filename=search.png&path= ' .$ file .'&length= ' .filesize ($ file ).'&uploadUniqueIdentifier= ' .basename ($ identifier );
91
- $ page = $ this ->webroot .'item/process_http_upload/ ' .$ this ->item .'? ' .$ params ;
92
-
106
+ $ params = 'testingmode=1&filename=search.png&localinput= ' .$ file .'&length= ' .filesize ($ file ).'&uploadUniqueIdentifier= ' .$ subdir .'/httpupload.png ' ;
93
107
$ page = 'upload/processjavaupload/? ' .$ params ;
94
-
95
- $ usersFile = $ this ->loadData ('User ' , 'default ' );
96
- $ userDao = $ this ->User ->load ($ usersFile [0 ]->getKey ());
97
108
$ this ->dispatchUrI ($ page , $ userDao );
98
109
99
110
$ search = $ this ->Item ->getItemsFromSearch ('search.png ' , $ userDao );
0 commit comments