Passed
Push — v6 ( fbfd37...6aa863 )
by 光春
03:18
created
src/service/ksyun/bin/config/Consts.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -2,53 +2,53 @@
 block discarded – undo
2 2
 require_once KS3_API_PATH.DIRECTORY_SEPARATOR."core".DIRECTORY_SEPARATOR."Headers.php";
3 3
 
4 4
 class Consts {
5
-	// static $Ks3EndPoint = "kss.ksyun.com";
6
-	static $SubResource = array("acl", "lifecycle", "location", "logging", "notification", "policy", "requestPayment", "torrent", "uploadId", "uploads", "versionId","versioning", "versions", "website", "delete", "thumbnail","cors","pfop","querypfop","adp","queryadp");	
7
-	static $QueryParam = array("partNumber","response-content-type","response-content-language","response-expires", "response-cache-control","response-content-disposition", "response-content-encoding", );
8
-	static $Acl = array("private","public-read","public-read-write");
9
-	static $KS3HeaderPrefix = "x-kss-";
10
-	static $CORSElements = array("AllowedMethod","AllowedOrigin","AllowedHeader","MaxAgeSeconds","ExposeHeader");
11
-	static $BucketLoggingElements = array("TargetBucket","TargetPrefix");
12
-	static $ObjectMeta = array("Cache-Control","Content-Disposition","Content-Encoding","Content-Length","Content-MD5","Content-Type","Expires");
13
-	static $MultipartObjectMeta = array("Cache-Control","Content-Disposition","Content-Encoding","Content-Type","Expires");
14
-	static $UserMetaPrefix = "x-kss-meta";
15
-	static $ResponseObjectMeta = array(
16
-		"cache-control"=>"Cache-Control",
17
-		"content-disposition"=>"Content-Disposition",
18
-		"content-encoding"=>"Content-Encoding",
19
-		"etag"=>"ETag",
20
-		"content-type"=>"Content-Type",
21
-		"expires"=>"Expires",
22
-		"last-modified"=>"Last-Modified",
23
-		"content-range"=>"Content-Range",
24
-		"content-length"=>"Content-Length",
25
-		"x-kss-server-side-encryption"=>"SSEAlgm",
26
-		"x-kss-server-side-encryption-kss-kms-key-id"=>"SSEKMSId",
27
-		"x-kss-server-side-encryption-customer-algorithm"=>"SSECAlgm",
28
-		"x-kss-server-side-encryption-customer-key-md5"=>"SSECKeyMD5"
29
-		);
30
-	static $PartsElement = array("PartNumber","ETag");
31
-	static $UploadHandler = array(
32
-		"etag"=>"ETag",
33
-		"taskid"=>"TaskID",
34
-		"x-kss-server-side-encryption"=>"SSEAlgm",
35
-		"x-kss-server-side-encryption-kss-kms-key-id"=>"SSEKMSId",
36
-		"x-kss-server-side-encryption-customer-algorithm"=>"SSECAlgm",
37
-		"x-kss-server-side-encryption-customer-key-md5"=>"SSECKeyMD5"
38
-		);
39
-	static $SSEHandler = array(
40
-		"x-kss-server-side-encryption"=>"SSEAlgm",
41
-		"x-kss-server-side-encryption-kss-kms-key-id"=>"SSEKMSId",
42
-		"x-kss-server-side-encryption-customer-algorithm"=>"SSECAlgm",
43
-		"x-kss-server-side-encryption-customer-key-md5"=>"SSECKeyMD5"
44
-		);
45
-	static $Permission_Read = "READ";
46
-	static $Permission_Write = "WRITE";
47
-	static $Grantee_Group_All = "http://acs.ksyun.com/groups/global/AllUsers";
48
-	static $ResponseOverrides = array("response-expires","response-content-encoding","response-content-disposition",
49
-		"response-content-language","response-content-type","response-cache-control");
50
-	static $CallBackMagics = array("bucket","key","etag","objectSize","mimeType","createTime");
51
-	static $UserAgent = "ks3-kss-php-sdk";
52
-	static $SSEDefaultAlgm = "AES256";
5
+    // static $Ks3EndPoint = "kss.ksyun.com";
6
+    static $SubResource = array("acl", "lifecycle", "location", "logging", "notification", "policy", "requestPayment", "torrent", "uploadId", "uploads", "versionId","versioning", "versions", "website", "delete", "thumbnail","cors","pfop","querypfop","adp","queryadp");	
7
+    static $QueryParam = array("partNumber","response-content-type","response-content-language","response-expires", "response-cache-control","response-content-disposition", "response-content-encoding", );
8
+    static $Acl = array("private","public-read","public-read-write");
9
+    static $KS3HeaderPrefix = "x-kss-";
10
+    static $CORSElements = array("AllowedMethod","AllowedOrigin","AllowedHeader","MaxAgeSeconds","ExposeHeader");
11
+    static $BucketLoggingElements = array("TargetBucket","TargetPrefix");
12
+    static $ObjectMeta = array("Cache-Control","Content-Disposition","Content-Encoding","Content-Length","Content-MD5","Content-Type","Expires");
13
+    static $MultipartObjectMeta = array("Cache-Control","Content-Disposition","Content-Encoding","Content-Type","Expires");
14
+    static $UserMetaPrefix = "x-kss-meta";
15
+    static $ResponseObjectMeta = array(
16
+        "cache-control"=>"Cache-Control",
17
+        "content-disposition"=>"Content-Disposition",
18
+        "content-encoding"=>"Content-Encoding",
19
+        "etag"=>"ETag",
20
+        "content-type"=>"Content-Type",
21
+        "expires"=>"Expires",
22
+        "last-modified"=>"Last-Modified",
23
+        "content-range"=>"Content-Range",
24
+        "content-length"=>"Content-Length",
25
+        "x-kss-server-side-encryption"=>"SSEAlgm",
26
+        "x-kss-server-side-encryption-kss-kms-key-id"=>"SSEKMSId",
27
+        "x-kss-server-side-encryption-customer-algorithm"=>"SSECAlgm",
28
+        "x-kss-server-side-encryption-customer-key-md5"=>"SSECKeyMD5"
29
+        );
30
+    static $PartsElement = array("PartNumber","ETag");
31
+    static $UploadHandler = array(
32
+        "etag"=>"ETag",
33
+        "taskid"=>"TaskID",
34
+        "x-kss-server-side-encryption"=>"SSEAlgm",
35
+        "x-kss-server-side-encryption-kss-kms-key-id"=>"SSEKMSId",
36
+        "x-kss-server-side-encryption-customer-algorithm"=>"SSECAlgm",
37
+        "x-kss-server-side-encryption-customer-key-md5"=>"SSECKeyMD5"
38
+        );
39
+    static $SSEHandler = array(
40
+        "x-kss-server-side-encryption"=>"SSEAlgm",
41
+        "x-kss-server-side-encryption-kss-kms-key-id"=>"SSEKMSId",
42
+        "x-kss-server-side-encryption-customer-algorithm"=>"SSECAlgm",
43
+        "x-kss-server-side-encryption-customer-key-md5"=>"SSECKeyMD5"
44
+        );
45
+    static $Permission_Read = "READ";
46
+    static $Permission_Write = "WRITE";
47
+    static $Grantee_Group_All = "http://acs.ksyun.com/groups/global/AllUsers";
48
+    static $ResponseOverrides = array("response-expires","response-content-encoding","response-content-disposition",
49
+        "response-content-language","response-content-type","response-cache-control");
50
+    static $CallBackMagics = array("bucket","key","etag","objectSize","mimeType","createTime");
51
+    static $UserAgent = "ks3-kss-php-sdk";
52
+    static $SSEDefaultAlgm = "AES256";
53 53
 }
54 54
 ?>
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
src/service/ksyun/bin/unit/Test.php 1 patch
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -7,138 +7,138 @@  discard block
 block discarded – undo
7 7
 require_once "PUnit.php";
8 8
 require_once "../lib/RequestCore.class.php";
9 9
 class SDKTest extends PUnit{
10
-	protected $bucket = "php-sdk-test";
11
-	protected $key = "test==中/文?";
12
-	protected $key_copy = "test中/文_copy?";
13
-	protected $accesskey = "";
14
-	protected $secrectkey = "";
15
-	protected $client;
10
+    protected $bucket = "php-sdk-test";
11
+    protected $key = "test==中/文?";
12
+    protected $key_copy = "test中/文_copy?";
13
+    protected $accesskey = "";
14
+    protected $secrectkey = "";
15
+    protected $client;
16 16
     protected $encryptionClient;
17
-	protected $cachedir;
17
+    protected $cachedir;
18 18
     protected $sseckey;
19
-	public function __construct(){
20
-		$this->client=new Ks3Client($this->accesskey,$this->secrectkey);
21
-		$this->cachedir=KS3_API_PATH.DIRECTORY_SEPARATOR."unit".DIRECTORY_SEPARATOR."cache".DIRECTORY_SEPARATOR;
19
+    public function __construct(){
20
+        $this->client=new Ks3Client($this->accesskey,$this->secrectkey);
21
+        $this->cachedir=KS3_API_PATH.DIRECTORY_SEPARATOR."unit".DIRECTORY_SEPARATOR."cache".DIRECTORY_SEPARATOR;
22 22
         $filename = "secret.key";
23 23
         $handle = fopen($filename, "r");
24 24
         $sseckey = fread($handle, filesize ($filename));
25 25
         fclose($handle);
26 26
         $this->sseckey = $sseckey;
27 27
         $this->encryptionClient = new Ks3EncryptionClient($this->accesskey,$this->secrectkey,$sseckey);
28
-	}
29
-	public function before(){
30
-		if($this->client->bucketExists(array("Bucket"=>$this->bucket))){
31
-			$keys = array();
32
-			$objects = $this->client->listObjects(array("Bucket"=>$this->bucket));
33
-			foreach ($objects["Contents"] as $object) {
34
-				array_push($keys, $object["Key"]);
35
-			}
36
-			$this->client->deleteObjects(array("Bucket"=>$this->bucket,"DeleteKeys"=>$keys));
37
-		}else{
38
-			$this->client->createBucket(array("Bucket"=>$this->bucket));
39
-		}
40
-	}
41
-	public function testListBuckets(){
42
-		$buckets = $this->client->listBuckets();
43
-		$found = FALSE;
44
-		foreach ($buckets as $bucket) {
45
-			if($bucket["Name"] == $this->bucket)
46
-				$found = TRUE;
47
-		}
48
-		if(!$found)
49
-			throw new Exception("list buckets expected found ".$this->bucket.",but not found");
28
+    }
29
+    public function before(){
30
+        if($this->client->bucketExists(array("Bucket"=>$this->bucket))){
31
+            $keys = array();
32
+            $objects = $this->client->listObjects(array("Bucket"=>$this->bucket));
33
+            foreach ($objects["Contents"] as $object) {
34
+                array_push($keys, $object["Key"]);
35
+            }
36
+            $this->client->deleteObjects(array("Bucket"=>$this->bucket,"DeleteKeys"=>$keys));
37
+        }else{
38
+            $this->client->createBucket(array("Bucket"=>$this->bucket));
39
+        }
40
+    }
41
+    public function testListBuckets(){
42
+        $buckets = $this->client->listBuckets();
43
+        $found = FALSE;
44
+        foreach ($buckets as $bucket) {
45
+            if($bucket["Name"] == $this->bucket)
46
+                $found = TRUE;
47
+        }
48
+        if(!$found)
49
+            throw new Exception("list buckets expected found ".$this->bucket.",but not found");
50 50
 			
51
-	}
52
-	public function testDeleteBucket(){
53
-		$this->client->putObjectByContent(array("Bucket"=>$this->bucket,"Key"=>"test","Content"=>""));
54
-		$ex = NULL;
55
-		try{
56
-			$this->client->deleteBucket(array("Bucket"=>$this->bucket));
57
-		}catch(Exception $e){
58
-			$ex = $e;
59
-		}
60
-		if($ex == NULL||!($ex->errorCode === "BucketNotEmpty")){
61
-			throw new Exception("delete bucket expected BucketNotEmpty but ".$ex);
62
-		}
63
-	}
64
-	public function testBucketCORS(){
65
-		$this->client->setBucketCORS($args = array(
66
-       		"Bucket"=>$this->bucket,
67
-        	"CORS"=>array(
68
-        		array(
69
-           			"AllowedMethod"=>array("GET","PUT"),
70
-            		"AllowedOrigin"=>array("http://www.kingsoft.com"),
71
-            		"AllowedHeader"=>array("*"),
72
-            		"ExposeHeader"=>array("*"),
73
-            		"MaxAgeSeconds"=>10
74
-        		),
75
-        		array(
76
-         		  "AllowedMethod"=>array("GET","PUT"),
77
-          		  "AllowedOrigin"=>array("*"),
78
-          		  "AllowedHeader"=>array("*"),
79
-          		  "ExposeHeader"=>array("*"),
80
-          		  "MaxAgeSeconds"=>10
81
-        		)
82
-    		)));
83
- 	    $cors = $this->client->getBucketCORS(array("Bucket"=>$this->bucket));
84
- 	    $this->assertEquals(count($cors),2,"bucket cors count ");
85
-   		$this->client->deleteBucketCORS(array("Bucket"=>$this->bucket));
86
-   		$cors = $this->client->getBucketCORS(array("Bucket"=>$this->bucket));
87
-		$this->assertEquals(count($cors),0,"bucket cors count ");
88
-	}
89
-	public function testCreateBucket(){
90
-		$ex = NULL;
91
-		try{
92
-			$this->client->createBucket(array("Bucket"=>$this->bucket));
93
-		}catch(Exception $e){
94
-			$ex = $e;
95
-		}
96
-		if($ex == NULL||!($ex->errorCode === "BucketAlreadyExists")){
97
-			throw new Exception("create bucket expected BucketAlreadyExists but ".$ex);
98
-		}
99
-	}
100
-	public function testACL(){
101
-		$this->client->setBucketAcl(array("Bucket"=>$this->bucket,"ACL"=>"public-read"));
102
-		$acl = $this->client->getBucketAcl(array("Bucket"=>$this->bucket));
103
-		$this->assertEquals($acl,"public-read","bucket acl");
104
-	}
105
-	public function testBucketLogging(){
106
-		$this->client->setBucketLogging(array(
107
-        	"Bucket"=>$this->bucket,
108
-        	"BucketLogging"=>array(
109
-            	"Enable"=>TRUE,
110
-            	"TargetBucket"=>$this->bucket,
111
-            	"TargetPrefix"=>"X-KSS"
51
+    }
52
+    public function testDeleteBucket(){
53
+        $this->client->putObjectByContent(array("Bucket"=>$this->bucket,"Key"=>"test","Content"=>""));
54
+        $ex = NULL;
55
+        try{
56
+            $this->client->deleteBucket(array("Bucket"=>$this->bucket));
57
+        }catch(Exception $e){
58
+            $ex = $e;
59
+        }
60
+        if($ex == NULL||!($ex->errorCode === "BucketNotEmpty")){
61
+            throw new Exception("delete bucket expected BucketNotEmpty but ".$ex);
62
+        }
63
+    }
64
+    public function testBucketCORS(){
65
+        $this->client->setBucketCORS($args = array(
66
+                "Bucket"=>$this->bucket,
67
+            "CORS"=>array(
68
+                array(
69
+                        "AllowedMethod"=>array("GET","PUT"),
70
+                    "AllowedOrigin"=>array("http://www.kingsoft.com"),
71
+                    "AllowedHeader"=>array("*"),
72
+                    "ExposeHeader"=>array("*"),
73
+                    "MaxAgeSeconds"=>10
74
+                ),
75
+                array(
76
+                    "AllowedMethod"=>array("GET","PUT"),
77
+                    "AllowedOrigin"=>array("*"),
78
+                    "AllowedHeader"=>array("*"),
79
+                    "ExposeHeader"=>array("*"),
80
+                    "MaxAgeSeconds"=>10
81
+                )
82
+            )));
83
+            $cors = $this->client->getBucketCORS(array("Bucket"=>$this->bucket));
84
+            $this->assertEquals(count($cors),2,"bucket cors count ");
85
+            $this->client->deleteBucketCORS(array("Bucket"=>$this->bucket));
86
+            $cors = $this->client->getBucketCORS(array("Bucket"=>$this->bucket));
87
+        $this->assertEquals(count($cors),0,"bucket cors count ");
88
+    }
89
+    public function testCreateBucket(){
90
+        $ex = NULL;
91
+        try{
92
+            $this->client->createBucket(array("Bucket"=>$this->bucket));
93
+        }catch(Exception $e){
94
+            $ex = $e;
95
+        }
96
+        if($ex == NULL||!($ex->errorCode === "BucketAlreadyExists")){
97
+            throw new Exception("create bucket expected BucketAlreadyExists but ".$ex);
98
+        }
99
+    }
100
+    public function testACL(){
101
+        $this->client->setBucketAcl(array("Bucket"=>$this->bucket,"ACL"=>"public-read"));
102
+        $acl = $this->client->getBucketAcl(array("Bucket"=>$this->bucket));
103
+        $this->assertEquals($acl,"public-read","bucket acl");
104
+    }
105
+    public function testBucketLogging(){
106
+        $this->client->setBucketLogging(array(
107
+            "Bucket"=>$this->bucket,
108
+            "BucketLogging"=>array(
109
+                "Enable"=>TRUE,
110
+                "TargetBucket"=>$this->bucket,
111
+                "TargetPrefix"=>"X-KSS"
112 112
             )
113 113
         ));
114
-    	$logging = $this->client->getBucketLogging(array("Bucket"=>$this->bucket));
115
-    	$this->assertEquals($logging["Enable"],TRUE,"bucket logging enable");
114
+        $logging = $this->client->getBucketLogging(array("Bucket"=>$this->bucket));
115
+        $this->assertEquals($logging["Enable"],TRUE,"bucket logging enable");
116 116
 
117
-    	$this->client->setBucketLogging(array(
118
-    		"Bucket"=>$this->bucket,
119
-    		"BucketLogging"=>array(
120
-        		"Enable"=>FALSE,//是否开启
121
-        	)
122
-    	));
123
-    	$logging = $this->client->getBucketLogging(array("Bucket"=>$this->bucket));
124
-    	$this->assertEquals($logging["Enable"],FALSE,"bucket logging enable");
125
-	}
126
-	public function testBucketLocation(){
127
-		$location = $this->client->getBucketLocation(array("Bucket"=>$this->bucket));
128
-		$this->assertEquals($location,"HANGZHOU","bucket location ");
129
-	}
130
-	public function testPutObjectByContentAndGetObjectContent(){
131
-		$args = array(
132
-        	"Bucket"=>$this->bucket,
133
-        	"Key"=>$this->key,
134
-        	"Content"=>"1234",//要上传的内容
135
-        	"ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
136
-        	"ObjectMeta"=>array(
137
-            	"Content-Type"=>"application/xml",
138
-            	"Content-Length"=>3
117
+        $this->client->setBucketLogging(array(
118
+            "Bucket"=>$this->bucket,
119
+            "BucketLogging"=>array(
120
+                "Enable"=>FALSE,//是否开启
121
+            )
122
+        ));
123
+        $logging = $this->client->getBucketLogging(array("Bucket"=>$this->bucket));
124
+        $this->assertEquals($logging["Enable"],FALSE,"bucket logging enable");
125
+    }
126
+    public function testBucketLocation(){
127
+        $location = $this->client->getBucketLocation(array("Bucket"=>$this->bucket));
128
+        $this->assertEquals($location,"HANGZHOU","bucket location ");
129
+    }
130
+    public function testPutObjectByContentAndGetObjectContent(){
131
+        $args = array(
132
+            "Bucket"=>$this->bucket,
133
+            "Key"=>$this->key,
134
+            "Content"=>"1234",//要上传的内容
135
+            "ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
136
+            "ObjectMeta"=>array(
137
+                "Content-Type"=>"application/xml",
138
+                "Content-Length"=>3
139 139
             ),
140
-        	"UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
141
-            	"x-kss-meta-test"=>"test"
140
+            "UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
141
+                "x-kss-meta-test"=>"test"
142 142
             )
143 143
         );
144 144
         $this->client->putObjectByContent($args);
@@ -156,21 +156,21 @@  discard block
 block discarded – undo
156 156
         $this->assertEquals($meta["ObjectMeta"]["Content-Type"],"application/xml","Content-Type");
157 157
         $this->assertEquals($meta["ObjectMeta"]["Content-Length"],3,"Content-Length");
158 158
 
159
-	}
160
-	public function testPutObjectByFile(){
161
-		$args = array(
162
-        	"Bucket"=>$this->bucket,
163
-        	"Key"=>$this->key,
164
-        	"Content"=>array(
165
-        		"content"=>$this->cachedir."test_file"
166
-        	),//要上传的内容
167
-        	"ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
168
-        	"ObjectMeta"=>array(
169
-            	"Content-Type"=>"application/xml",
170
-            	"Content-Length"=>100
159
+    }
160
+    public function testPutObjectByFile(){
161
+        $args = array(
162
+            "Bucket"=>$this->bucket,
163
+            "Key"=>$this->key,
164
+            "Content"=>array(
165
+                "content"=>$this->cachedir."test_file"
166
+            ),//要上传的内容
167
+            "ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
168
+            "ObjectMeta"=>array(
169
+                "Content-Type"=>"application/xml",
170
+                "Content-Length"=>100
171 171
             ),
172
-        	"UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
173
-            	"x-kss-meta-test"=>"test"
172
+            "UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
173
+                "x-kss-meta-test"=>"test"
174 174
             )
175 175
         );
176 176
         $this->client->putObjectByFile($args);
@@ -180,47 +180,47 @@  discard block
 block discarded – undo
180 180
         $this->assertEquals($meta["ObjectMeta"]["Content-Type"],"application/xml","Content-Type");
181 181
         $this->assertEquals($meta["ObjectMeta"]["Content-Length"],100,"Content-Length");
182 182
         $this->assertEquals($this->client->getObjectAcl(array("Bucket"=>$this->bucket,"Key"=>$this->key)),"public-read","object acl ");
183
-	}
184
-	public function testObjectAcl(){
185
-		$this->client->putObjectByContent(array("Bucket"=>$this->bucket,"Key"=>$this->key,
183
+    }
184
+    public function testObjectAcl(){
185
+        $this->client->putObjectByContent(array("Bucket"=>$this->bucket,"Key"=>$this->key,
186 186
 "Content"=>"1234","ACL"=>"private"));
187
-		$this->assertEquals($this->client->getObjectAcl(array("Bucket"=>$this->bucket,"Key"=>$this->key)),"private","object acl");
188
-		$this->client->setObjectAcl(array("Bucket"=>$this->bucket,"Key"=>$this->key,"ACL"=>"public-read"));
189
-		$this->assertEquals($this->client->getObjectAcl(array("Bucket"=>$this->bucket,"Key"=>$this->key)),"public-read","object acl");
190
-	}
191
-	public function testDeleteObject(){
192
-		$this->client->putObjectByContent(array("Bucket"=>$this->bucket,"Key"=>$this->key,
187
+        $this->assertEquals($this->client->getObjectAcl(array("Bucket"=>$this->bucket,"Key"=>$this->key)),"private","object acl");
188
+        $this->client->setObjectAcl(array("Bucket"=>$this->bucket,"Key"=>$this->key,"ACL"=>"public-read"));
189
+        $this->assertEquals($this->client->getObjectAcl(array("Bucket"=>$this->bucket,"Key"=>$this->key)),"public-read","object acl");
190
+    }
191
+    public function testDeleteObject(){
192
+        $this->client->putObjectByContent(array("Bucket"=>$this->bucket,"Key"=>$this->key,
193 193
 "Content"=>"1234"));
194
-		$this->client->deleteObject(array("Bucket"=>$this->bucket,"Key"=>$this->key));
195
-		$this->assertEquals($this->client->objectExists(array("Bucket"=>$this->bucket,"Key"=>$this->key)),FALSE,"object exits");
196
-	}
197
-	public function testDeleteObjects(){
198
-		$this->client->putObjectByContent(array("Bucket"=>$this->bucket,"Key"=>$this->key,
194
+        $this->client->deleteObject(array("Bucket"=>$this->bucket,"Key"=>$this->key));
195
+        $this->assertEquals($this->client->objectExists(array("Bucket"=>$this->bucket,"Key"=>$this->key)),FALSE,"object exits");
196
+    }
197
+    public function testDeleteObjects(){
198
+        $this->client->putObjectByContent(array("Bucket"=>$this->bucket,"Key"=>$this->key,
199 199
 "Content"=>"1234"));
200
-		$this->client->deleteObjects(array("Bucket"=>$this->bucket,"DeleteKeys"=>array($this->key)));
201
-		$this->assertEquals($this->client->objectExists(array("Bucket"=>$this->bucket,"Key"=>$this->key)),FALSE,"object exits");		
202
-	}
203
-	public function testCopyObject(){
204
-		$this->client->putObjectByContent(array("Bucket"=>$this->bucket,"Key"=>$this->key,
200
+        $this->client->deleteObjects(array("Bucket"=>$this->bucket,"DeleteKeys"=>array($this->key)));
201
+        $this->assertEquals($this->client->objectExists(array("Bucket"=>$this->bucket,"Key"=>$this->key)),FALSE,"object exits");		
202
+    }
203
+    public function testCopyObject(){
204
+        $this->client->putObjectByContent(array("Bucket"=>$this->bucket,"Key"=>$this->key,
205 205
 "Content"=>"1234"));
206
-		$this->client->copyObject(array("Bucket"=>$this->bucket,"Key"=>$this->key_copy,"CopySource"=>array("Bucket"=>$this->bucket,"Key"=>$this->key)));
207
-		$this->assertEquals($this->client->objectExists(array("Bucket"=>$this->bucket,"Key"=>$this->key)),TRUE,"object exits");
208
-		$this->assertEquals($this->client->objectExists(array("Bucket"=>$this->bucket,"Key"=>$this->key_copy)),TRUE
209
-			,"object exits");
210
-	}
211
-	public function testPutAndGetObject(){
212
-		$args = array(
213
-        	"Bucket"=>$this->bucket,
214
-        	"Key"=>$this->key,
215
-        	"Content"=>array(
216
-        		"content"=>$this->cachedir."test_file"
217
-        	),//要上传的内容
218
-        	"ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
219
-        	"ObjectMeta"=>array(
220
-            	"Content-Type"=>"application/xml",
206
+        $this->client->copyObject(array("Bucket"=>$this->bucket,"Key"=>$this->key_copy,"CopySource"=>array("Bucket"=>$this->bucket,"Key"=>$this->key)));
207
+        $this->assertEquals($this->client->objectExists(array("Bucket"=>$this->bucket,"Key"=>$this->key)),TRUE,"object exits");
208
+        $this->assertEquals($this->client->objectExists(array("Bucket"=>$this->bucket,"Key"=>$this->key_copy)),TRUE
209
+            ,"object exits");
210
+    }
211
+    public function testPutAndGetObject(){
212
+        $args = array(
213
+            "Bucket"=>$this->bucket,
214
+            "Key"=>$this->key,
215
+            "Content"=>array(
216
+                "content"=>$this->cachedir."test_file"
217
+            ),//要上传的内容
218
+            "ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
219
+            "ObjectMeta"=>array(
220
+                "Content-Type"=>"application/xml",
221 221
             ),
222
-        	"UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
223
-            	"x-kss-meta-test"=>"test"
222
+            "UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
223
+                "x-kss-meta-test"=>"test"
224 224
             )
225 225
         );
226 226
         $this->client->putObjectByFile($args);
@@ -229,49 +229,49 @@  discard block
 block discarded – undo
229 229
         $md5pre = md5_file($this->cachedir."test_file");
230 230
         @unlink($this->cachedir."down");
231 231
         $this->assertEquals($md5,$md5pre,"contentmd5");
232
-	}
233
-	public function testPutAndGetObjectRanges(){
234
-		$args = array(
235
-        	"Bucket"=>$this->bucket,
236
-        	"Key"=>$this->key,
237
-        	"Content"=>array(
238
-        		"content"=>$this->cachedir."test_file"
239
-        	),//要上传的内容
240
-        	"ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
241
-        	"ObjectMeta"=>array(
242
-            	"Content-Type"=>"application/xml",
232
+    }
233
+    public function testPutAndGetObjectRanges(){
234
+        $args = array(
235
+            "Bucket"=>$this->bucket,
236
+            "Key"=>$this->key,
237
+            "Content"=>array(
238
+                "content"=>$this->cachedir."test_file"
239
+            ),//要上传的内容
240
+            "ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
241
+            "ObjectMeta"=>array(
242
+                "Content-Type"=>"application/xml",
243 243
             ),
244
-        	"UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
245
-            	"x-kss-meta-test"=>"test"
244
+            "UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
245
+                "x-kss-meta-test"=>"test"
246 246
             )
247 247
         );
248 248
         $this->client->putObjectByFile($args);
249 249
         rangeGetAndCheckMd5($this->client,$this->bucket,$this->key,$this->cachedir."down",md5_file($this->cachedir."test_file"));
250
-	}
251
-	public function testInitAndAbortMultipart(){
252
-		$initResult = $this->client->initMultipartUpload(array("Bucket"=>$this->bucket,"Key"=>$this->key));
253
-		$uid = $initResult["UploadId"];
254
-		$listParts = $this->client->listParts(array("Bucket"=>$this->bucket,"Key"=>$this->key,"Options"=>array("uploadId"=>$uid)));
255
-		$this->client->abortMultipartUpload(array("Bucket"=>$this->bucket,"Key"=>$this->key,"Options"=>array("uploadId"=>$uid)));
256
-		$ex = NULL;
257
-		try{
258
-			$this->client->listParts(array("Bucket"=>$this->bucket,"Key"=>$this->key,"Options"=>array("uploadId"=>$uid)));
259
-		}catch(Exception $e){
260
-			$ex = $e;
261
-		}
262
-		if($ex == NULL||!($ex->errorCode === "NoSuchUpload")){
263
-			throw new Exception("create bucket expected NoSuchUpload but ".$ex);
264
-		}
265
-	}
266
-	public function testMultipartUpload(){
267
-		generateFile(1024*1024,$this->cachedir."multi");
268
-		//初始化分开上传,获取uploadid
250
+    }
251
+    public function testInitAndAbortMultipart(){
252
+        $initResult = $this->client->initMultipartUpload(array("Bucket"=>$this->bucket,"Key"=>$this->key));
253
+        $uid = $initResult["UploadId"];
254
+        $listParts = $this->client->listParts(array("Bucket"=>$this->bucket,"Key"=>$this->key,"Options"=>array("uploadId"=>$uid)));
255
+        $this->client->abortMultipartUpload(array("Bucket"=>$this->bucket,"Key"=>$this->key,"Options"=>array("uploadId"=>$uid)));
256
+        $ex = NULL;
257
+        try{
258
+            $this->client->listParts(array("Bucket"=>$this->bucket,"Key"=>$this->key,"Options"=>array("uploadId"=>$uid)));
259
+        }catch(Exception $e){
260
+            $ex = $e;
261
+        }
262
+        if($ex == NULL||!($ex->errorCode === "NoSuchUpload")){
263
+            throw new Exception("create bucket expected NoSuchUpload but ".$ex);
264
+        }
265
+    }
266
+    public function testMultipartUpload(){
267
+        generateFile(1024*1024,$this->cachedir."multi");
268
+        //初始化分开上传,获取uploadid
269 269
         $args = array(
270 270
             "Bucket"=>$this->bucket,
271 271
             "Key"=>$this->key,
272 272
             "ACL"=>"public-read",
273 273
             "UserMeta"=>array(
274
-            	"x-kss-meta-test"=>"example"
274
+                "x-kss-meta-test"=>"example"
275 275
             ),
276 276
         "ObjectMeta"=>array(
277 277
             "Content-Type"=>"application/xml"
@@ -323,21 +323,21 @@  discard block
 block discarded – undo
323 323
         $this->assertEquals($meta["UserMeta"]["x-kss-meta-test"],"example","x-kss-meta-test");
324 324
         rangeGetAndCheckMd5($this->client,$this->bucket,$this->key,$this->cachedir."down",md5_file($this->cachedir."multi"));
325 325
         @unlink($this->cachedir."multi");
326
-	}
327
-	public function testListBucketsPresignedUrl(){
328
-		$url = $this->client->generatePresignedUrl(
329
-			array(
330
-				"Method"=>"GET",
331
-				"Options"=>array("Expires"=>60*10),
332
-				"Headers"=>array("Content-Type"=>"text/plain")
333
-				));
334
-		$httpRequest = new RequestCore($url);
335
-		$httpRequest->set_method("GET");
326
+    }
327
+    public function testListBucketsPresignedUrl(){
328
+        $url = $this->client->generatePresignedUrl(
329
+            array(
330
+                "Method"=>"GET",
331
+                "Options"=>array("Expires"=>60*10),
332
+                "Headers"=>array("Content-Type"=>"text/plain")
333
+                ));
334
+        $httpRequest = new RequestCore($url);
335
+        $httpRequest->set_method("GET");
336 336
         $httpRequest->add_header("Content-Type","text/plain");
337
-		$httpRequest->send_request();
338
-		$body = $httpRequest->get_response_body ();	
339
-		$this->assertEquals($httpRequest->get_response_code()." body:".$body,200,"list buckets status code");
340
-	}
337
+        $httpRequest->send_request();
338
+        $body = $httpRequest->get_response_body ();	
339
+        $this->assertEquals($httpRequest->get_response_code()." body:".$body,200,"list buckets status code");
340
+    }
341 341
     public function testHeadBucketPresignedUrl(){
342 342
         $url = $this->client->generatePresignedUrl(
343 343
             array(
@@ -618,16 +618,16 @@  discard block
 block discarded – undo
618 618
             "Bucket"=>$this->bucket,
619 619
             "Key"=>$this->key,
620 620
             "Content"=>"12345",//要上传的内容
621
-             "ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
622
-             "ObjectMeta"=>array(//设置object的元数据,可以设置"Cache-Control","Content-Disposition","Content-Encoding","Content-Length","Content-MD5","Content-Type","Expires"。当设置了Content-Length时,请勿大于实际长度,如果小于实际长度,将只上传部分内容。
621
+                "ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
622
+                "ObjectMeta"=>array(//设置object的元数据,可以设置"Cache-Control","Content-Disposition","Content-Encoding","Content-Length","Content-MD5","Content-Type","Expires"。当设置了Content-Length时,请勿大于实际长度,如果小于实际长度,将只上传部分内容。
623 623
                 "Content-Type"=>"binay/ocet-stream"
624 624
             ),
625 625
             "UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
626
-              "x-kss-meta-test"=>"test"
626
+                "x-kss-meta-test"=>"test"
627 627
             ),
628 628
             "SSE"=>array(
629 629
                 "Algm"=>"AES256"//暂时支持AES256
630
-             )
630
+                )
631 631
         );
632 632
         $result = $this->client->putObjectByContent($args);
633 633
         $this->assertEquals($result["SSEAlgm"],"AES256");
@@ -645,16 +645,16 @@  discard block
 block discarded – undo
645 645
             "Bucket"=>$this->bucket,
646 646
             "Key"=>$this->key,
647 647
             "Content"=>"12345",//要上传的内容
648
-             "ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
649
-             "ObjectMeta"=>array(//设置object的元数据,可以设置"Cache-Control","Content-Disposition","Content-Encoding","Content-Length","Content-MD5","Content-Type","Expires"。当设置了Content-Length时,请勿大于实际长度,如果小于实际长度,将只上传部分内容。
648
+                "ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
649
+                "ObjectMeta"=>array(//设置object的元数据,可以设置"Cache-Control","Content-Disposition","Content-Encoding","Content-Length","Content-MD5","Content-Type","Expires"。当设置了Content-Length时,请勿大于实际长度,如果小于实际长度,将只上传部分内容。
650 650
                 "Content-Type"=>"binay/ocet-stream"
651 651
             ),
652 652
             "UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
653
-              "x-kss-meta-test"=>"test"
653
+                "x-kss-meta-test"=>"test"
654 654
             ),
655 655
             "SSEC"=>array(
656 656
                 "Key"=>$this->sseckey
657
-             )
657
+                )
658 658
         );
659 659
         $result = $this->client->putObjectByContent($args);
660 660
         $this->assertEquals($result["SSECAlgm"],"AES256");
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
             "Key"=>$this->key,
666 666
             "SSEC"=>array(
667 667
                 "Key"=>$this->sseckey
668
-             )
668
+                )
669 669
             );
670 670
         $result = $this->client->getObjectMeta($args);
671 671
         $this->assertEquals($result["ObjectMeta"]["SSECAlgm"],"AES256");
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
             "WriteTo"=>$this->cachedir."down", //文件保存路径,必须提供。可以是resource
678 678
             "SSEC"=>array(
679 679
                 "Key"=>$this->sseckey
680
-             )
680
+                )
681 681
         );
682 682
         $this->client->getObject($args);
683 683
         $this->assertEquals("12345",file_get_contents($this->cachedir."down"));
@@ -779,16 +779,16 @@  discard block
 block discarded – undo
779 779
             "Bucket"=>$this->bucket,
780 780
             "Key"=>$this->key,
781 781
             "Content"=>"12345",//要上传的内容
782
-             "ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
783
-             "ObjectMeta"=>array(//设置object的元数据,可以设置"Cache-Control","Content-Disposition","Content-Encoding","Content-Length","Content-MD5","Content-Type","Expires"。当设置了Content-Length时,请勿大于实际长度,如果小于实际长度,将只上传部分内容。
782
+                "ACL"=>"public-read",//可以设置访问权限,合法值,private、public-read
783
+                "ObjectMeta"=>array(//设置object的元数据,可以设置"Cache-Control","Content-Disposition","Content-Encoding","Content-Length","Content-MD5","Content-Type","Expires"。当设置了Content-Length时,请勿大于实际长度,如果小于实际长度,将只上传部分内容。
784 784
                 "Content-Type"=>"binay/ocet-stream"
785 785
             ),
786 786
             "UserMeta"=>array(//可以设置object的用户元数据,需要以x-kss-meta-开头
787
-              "x-kss-meta-test"=>"test"
787
+                "x-kss-meta-test"=>"test"
788 788
             ),
789 789
             "SSEC"=>array(
790 790
                 "Key"=>$this->sseckey
791
-             )
791
+                )
792 792
         );
793 793
         $result = $this->client->putObjectByContent($args);
794 794
 
@@ -799,10 +799,10 @@  discard block
 block discarded – undo
799 799
                 "Bucket"=>$this->bucket,
800 800
                 "Key"=>$this->key
801 801
                 ),
802
-             "SSECSource"=>array(
802
+                "SSECSource"=>array(
803 803
                 "Key"=>$this->sseckey
804 804
                 ),
805
-             "SSEC"=>array(
805
+                "SSEC"=>array(
806 806
                 "Key"=>$this->sseckey
807 807
                 )
808 808
             );
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
             );
822 822
             $this->encryptionClient->putObjectByContent($args);
823 823
             rangeGetAndCheckMd5($this->encryptionClient,$this->bucket,$this->key,
824
-               $this->cachedir."down",md5($args["Content"]));
824
+                $this->cachedir."down",md5($args["Content"]));
825 825
         }
826 826
     }
827 827
     public function testPutObjectByFileAndGetObjectUsingEncyptionMeta(){
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
         );
836 836
         $this->encryptionClient->putObjectByFile($args);
837 837
         rangeGetAndCheckMd5($this->encryptionClient,$this->bucket,$this->key,
838
-               $this->cachedir."down",md5_file($this->cachedir."test_file"));
838
+                $this->cachedir."down",md5_file($this->cachedir."test_file"));
839 839
     }
840 840
     public function testMultipartUploadUsingEncyptionMeta(){
841 841
         generateFile(1024*1024,$this->cachedir."multi");
Please login to merge, or discard this patch.
src/service/ksyun/bin/unit/TestUtil.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,53 +1,53 @@
 block discarded – undo
1 1
 <?php
2 2
 function rangeGetAndCheckMd5($client,$bucket,$key,$file,$expectedMd5){
3
-	$args = array("Bucket"=>$bucket,"Key"=>$key);
4
-	$meta = $client->getObjectMeta($args);
5
-	$contentlength = $meta["ObjectMeta"]["Content-Length"];
3
+    $args = array("Bucket"=>$bucket,"Key"=>$key);
4
+    $meta = $client->getObjectMeta($args);
5
+    $contentlength = $meta["ObjectMeta"]["Content-Length"];
6 6
 
7
-	$filelist = array();
7
+    $filelist = array();
8 8
 
9
-	for($begin = 0;$begin <$contentlength;){
10
-		$index = rand((int)($contentlength/20),(int)($contentlength/4));
11
-		$range = array("start"=>$begin,"end"=>$begin+$index);
12
-		$destFile = $file.$begin."-".($begin+$index);
13
-		array_push($filelist,$destFile);
14
-		$begin += ($index+1);
15
-		$args = array(
16
-			"Bucket"=>$bucket,
17
-			"Key"=>$key,
18
-			"Range"=>$range,
19
-			"WriteTo"=>$destFile
20
-		);
21
-		$client->getObject($args);
22
-	}
9
+    for($begin = 0;$begin <$contentlength;){
10
+        $index = rand((int)($contentlength/20),(int)($contentlength/4));
11
+        $range = array("start"=>$begin,"end"=>$begin+$index);
12
+        $destFile = $file.$begin."-".($begin+$index);
13
+        array_push($filelist,$destFile);
14
+        $begin += ($index+1);
15
+        $args = array(
16
+            "Bucket"=>$bucket,
17
+            "Key"=>$key,
18
+            "Range"=>$range,
19
+            "WriteTo"=>$destFile
20
+        );
21
+        $client->getObject($args);
22
+    }
23 23
 
24
-	foreach ($filelist as $key => $value) {
25
-		$handle = fopen($value,"r");
26
-		$size = filesize($value);
27
-		if($size > 0){
28
-			$content = fread($handle,$size);
29
-			file_put_contents($file,$content,FILE_APPEND);
30
-		}
31
-		fclose($handle);
32
-		//@unlink($value);
33
-	}
34
-	$md5 = md5_file($file);
35
-	//@unlink($file);	
36
-	if($md5 != $expectedMd5)
37
-		throw new Exception("file md5 check error expected ".$expectedMd5." ,actual ".$md5, 1);
38
-	foreach ($filelist as $key => $value) {
39
-		@unlink($value);
40
-	}
41
-	@unlink($file);
24
+    foreach ($filelist as $key => $value) {
25
+        $handle = fopen($value,"r");
26
+        $size = filesize($value);
27
+        if($size > 0){
28
+            $content = fread($handle,$size);
29
+            file_put_contents($file,$content,FILE_APPEND);
30
+        }
31
+        fclose($handle);
32
+        //@unlink($value);
33
+    }
34
+    $md5 = md5_file($file);
35
+    //@unlink($file);	
36
+    if($md5 != $expectedMd5)
37
+        throw new Exception("file md5 check error expected ".$expectedMd5." ,actual ".$md5, 1);
38
+    foreach ($filelist as $key => $value) {
39
+        @unlink($value);
40
+    }
41
+    @unlink($file);
42 42
 }
43 43
 function generateFile($sizeInBytes,$destFile){
44
-	for($i = 0;$i < $sizeInBytes/10;$i++){
45
-		$randpwd = "";  
46
-		for ($j = 0; $j < 10; $j++)  
47
-		{  
48
-			$randpwd .= chr(mt_rand(33, 126));  
49
-		}  
50
-		file_put_contents($destFile,$randpwd,FILE_APPEND);
51
-	}
44
+    for($i = 0;$i < $sizeInBytes/10;$i++){
45
+        $randpwd = "";  
46
+        for ($j = 0; $j < 10; $j++)  
47
+        {  
48
+            $randpwd .= chr(mt_rand(33, 126));  
49
+        }  
50
+        file_put_contents($destFile,$randpwd,FILE_APPEND);
51
+    }
52 52
 }
53 53
 ?>
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
src/service/ksyun/bin/unit/PUnit.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,60 +1,60 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once "../core/Logger.php";
3 3
 class PUnit{
4
-	function assertEquals($value,$expected,$info = NULL){
5
-		if($value != $expected){
6
-			throw new Exception($info." expected ".$expected." but ".$value);
7
-		}
8
-	}
9
-	function run($torun = NULL){
10
-   		$r = new ReflectionClass($this);
11
-    	foreach($r->getMethods() as $key=>$methodObj){
12
-      	  if($methodObj->isPrivate())
13
-           		 $methods[$key]['type'] = 'private';
14
-        	elseif($methodObj->isProtected())
15
-        	     $methods[$key]['type'] = 'protected';
16
-      		else
17
-           		 $methods[$key]['type'] = 'public';
18
-        	$methods[$key]['name'] = $methodObj->name;
19
-       		$methods[$key]['class'] = $methodObj->class;
20
-       	}
4
+    function assertEquals($value,$expected,$info = NULL){
5
+        if($value != $expected){
6
+            throw new Exception($info." expected ".$expected." but ".$value);
7
+        }
8
+    }
9
+    function run($torun = NULL){
10
+            $r = new ReflectionClass($this);
11
+        foreach($r->getMethods() as $key=>$methodObj){
12
+            if($methodObj->isPrivate())
13
+                    $methods[$key]['type'] = 'private';
14
+            elseif($methodObj->isProtected())
15
+                    $methods[$key]['type'] = 'protected';
16
+                else
17
+                    $methods[$key]['type'] = 'public';
18
+            $methods[$key]['name'] = $methodObj->name;
19
+                $methods[$key]['class'] = $methodObj->class;
20
+            }
21 21
         $before = NULL;
22 22
         $after = NULL;
23 23
         foreach ($methods as $method) {
24
-          if($method["class"] != "PUnit"&&$method["name"] == "before"){
24
+            if($method["class"] != "PUnit"&&$method["name"] == "before"){
25 25
             $before = $method;
26
-          }
27
-          if($method["class"] != "PUnit"&&$method["name"] == "after"){
26
+            }
27
+            if($method["class"] != "PUnit"&&$method["name"] == "after"){
28 28
             $after = $method;
29
-          }
29
+            }
30 30
         }
31
-       	$error = array();
32
-       	$success = array();
33
-       	foreach ($methods as $method) {
34
-       		if($method["class"] != "PUnit"&&substr($method["name"],0,4) == "test"){
31
+            $error = array();
32
+            $success = array();
33
+            foreach ($methods as $method) {
34
+                if($method["class"] != "PUnit"&&substr($method["name"],0,4) == "test"){
35 35
             if($torun !== NULL){
36
-              if(!in_array($method["name"],$torun))
36
+                if(!in_array($method["name"],$torun))
37 37
                 continue;
38 38
             }
39
-       			try{
40
-       				if($method["type"] == "public"){
39
+                    try{
40
+                        if($method["type"] == "public"){
41 41
                 $log = new Logger();
42 42
                 $log->info("Run unit --->".$method["name"]);
43 43
                 if($before!=NULL)
44
-                  $this->$before["name"]();
45
-       					$this->$method["name"]();
46
-       					array_push($success,$method["name"]);
47
-       				}
48
-       			}catch(Exception $e){
49
-       				$error[$method["name"]]="".$e;
50
-       			}
51
-       		}
52
-       	}
53
-       	echo "\r\nPHP Unit-----------error"."\r\n";
54
-       	print_r($error);
44
+                    $this->$before["name"]();
45
+                            $this->$method["name"]();
46
+                            array_push($success,$method["name"]);
47
+                        }
48
+                    }catch(Exception $e){
49
+                        $error[$method["name"]]="".$e;
50
+                    }
51
+                }
52
+            }
53
+            echo "\r\nPHP Unit-----------error"."\r\n";
54
+            print_r($error);
55 55
         echo "PHP Unit-----------result"."\r\n";
56 56
         echo "total:".(count($success)+count($error)).",success:".count($success).",error:".count($error)."\r\n";
57 57
 
58
-	}
58
+    }
59 59
 }
60 60
 ?>
61 61
\ No newline at end of file
Please login to merge, or discard this patch.