@@ -106,11 +106,11 @@ |
||
| 106 | 106 | $user->updatetime = date('Y-m-d G:i:s'); |
| 107 | 107 | $id = R::store($user); |
| 108 | 108 | $res = (object)["id" => $id]; |
| 109 | - }catch (Exception $e) { |
|
| 109 | + } catch (Exception $e) { |
|
| 110 | 110 | echo $e; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - }else { |
|
| 113 | + } else { |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
@@ -154,7 +154,7 @@ |
||
| 154 | 154 | return JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300); |
| 155 | 155 | } |
| 156 | 156 | public function markBadgeAsCompleted($id, $id_badge, Request $request) { |
| 157 | - $userbadge = R::findOne('userbadge',"WHERE user = ? AND badge = ?",[$id,$id_badge]); |
|
| 157 | + $userbadge = R::findOne('userbadge', "WHERE user = ? AND badge = ?", [$id, $id_badge]); |
|
| 158 | 158 | $userbadge->user = $id; |
| 159 | 159 | $userbadge->badge = $id_badge; |
| 160 | 160 | $userbadge->updatetime = date($this->DATE_FORMAT); |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | { |
| 10 | 10 | use AbstractAppTest; |
| 11 | 11 | |
| 12 | - public function testGetWorkspaceList(){ |
|
| 12 | + public function testGetWorkspaceList() { |
|
| 13 | 13 | $schema = __DIR__.'/../../../../api/schemas/workspaceList.json'; |
| 14 | 14 | |
| 15 | 15 | //$client = $this->createClient(); |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | if ($validator->isValid()) { |
| 57 | 57 | echo "The supplied JSON validates against the schema.\n"; |
| 58 | 58 | $assert = true; |
| 59 | - } else { |
|
| 59 | + }else { |
|
| 60 | 60 | echo "JSON does not validate. Violations:\n"; |
| 61 | 61 | foreach ($validator->getErrors() as $error) { |
| 62 | 62 | echo "[{$error['property']}] {$error['message']}\n"; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $headers = []; |
| 278 | 278 | $response = JsonResponse::create(["id"=>$wp_id], 200, $headers)->setSharedMaxAge(300); |
| 279 | 279 | |
| 280 | - }else { |
|
| 280 | + } else { |
|
| 281 | 281 | $headers = []; |
| 282 | 282 | $response = JsonResponse::create(["message"=>"Key no more valid"], 498, $headers)->setSharedMaxAge(300); |
| 283 | 283 | } |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | if ($b->completed === True) { |
| 483 | 483 | echo "CASO 1;<BR />"; |
| 484 | 484 | return $this->POINT_FOR_USING_A_CONQUERED_BADGE; |
| 485 | - }else { |
|
| 485 | + } else { |
|
| 486 | 486 | echo "CASO 2;<BR />"; |
| 487 | 487 | return $this->POINT_FOR_USING_A_BADGE; |
| 488 | 488 | } |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | "clientId"=>$user->id |
| 54 | 54 | ]; |
| 55 | 55 | $response = JsonResponse::create($res, 200, $headers)->setSharedMaxAge(300); |
| 56 | - }else { |
|
| 56 | + } else { |
|
| 57 | 57 | $headers = []; |
| 58 | 58 | $res = [ |
| 59 | 59 | "errore"=>"sbagliato password o user" //TODO roba |
| 60 | 60 | ]; |
| 61 | 61 | $response = JsonResponse::create($res, 401, $headers)->setSharedMaxAge(300); |
| 62 | 62 | } |
| 63 | - }else { |
|
| 63 | + } else { |
|
| 64 | 64 | //Facebook Redirect |
| 65 | 65 | } |
| 66 | 66 | return $response; // JsonResponse::create($output, 200, $headers)->setSharedMaxAge(300); |
@@ -81,14 +81,14 @@ discard block |
||
| 81 | 81 | if (!$bean->id) { |
| 82 | 82 | //TODO mettere un controllo agli IP che forzano le richieste di token falsi |
| 83 | 83 | $response = "<html><head></head><body>Token non esistente!</body></html>"; |
| 84 | - }else { |
|
| 84 | + } else { |
|
| 85 | 85 | if (strtotime($verify->inserttime) < strtotime("-15 minutes")) { |
| 86 | 86 | $user = R::load('user', $verify->user); |
| 87 | 87 | $user->status = "enabled"; |
| 88 | 88 | $user->updatetime = date('Y-m-d H:i:s'); |
| 89 | 89 | $id = R::store($user); |
| 90 | 90 | $response = "<html><head></head><body>Account attivato complimenti!</body></html>"; |
| 91 | - }else { |
|
| 91 | + } else { |
|
| 92 | 92 | $response = "<html><head></head><body>Impossibile attivare account inserire mail e password per richiedere un nuovo token!</body></html>"; |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace Tests; |
| 4 | 4 | |
| 5 | 5 | use Silex\WebTestCase; |
| 6 | -use JsonSchema\Validator; |
|
| 7 | 6 | |
| 8 | 7 | class WorkspaceTest extends WebTestCase |
| 9 | 8 | { |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | { |
| 10 | 10 | use AbstractAppTest; |
| 11 | 11 | |
| 12 | - public function testGetUser(){ |
|
| 12 | + public function testGetUser() { |
|
| 13 | 13 | $schema = __DIR__.'/../../../../api/schemas/userInfo.json'; |
| 14 | 14 | |
| 15 | 15 | $client = $this->createClient(); |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | $this->assertTrue($assert); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function testPostBadge(){ |
|
| 29 | + public function testPostBadge() { |
|
| 30 | 30 | $client = $this->createClient(); |
| 31 | 31 | $client = $this->logIn($client); |
| 32 | 32 | |
| 33 | - $badge_id=5; |
|
| 33 | + $badge_id = 5; |
|
| 34 | 34 | |
| 35 | 35 | $badge = '{ |
| 36 | 36 | "id": '.$badge_id.' |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | $badge); |
| 46 | 46 | |
| 47 | 47 | $response = $client->getResponse(); |
| 48 | - $this->assertEquals(200,$response->getStatusCode()); |
|
| 48 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 49 | 49 | return $badge_id; |
| 50 | 50 | } |
| 51 | - public function testGetBadge(){ |
|
| 51 | + public function testGetBadge() { |
|
| 52 | 52 | $schema = __DIR__.'/../../../../api/schemas/badgeUser.json'; |
| 53 | 53 | |
| 54 | 54 | $badge_id = $this->testPostBadge(); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $this->assertTrue($assert); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function testDeleteBadge(){ |
|
| 71 | + public function testDeleteBadge() { |
|
| 72 | 72 | $client = $this->createClient(); |
| 73 | 73 | $client = $this->logIn($client); |
| 74 | 74 | |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | ''); |
| 84 | 84 | |
| 85 | 85 | $response = $client->getResponse(); |
| 86 | - $this->assertEquals(204,$response->getStatusCode()); |
|
| 86 | + $this->assertEquals(204, $response->getStatusCode()); |
|
| 87 | 87 | return $badge_id; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public function testPostBadgeCompleted(){ |
|
| 90 | + public function testPostBadgeCompleted() { |
|
| 91 | 91 | $client = $this->createClient(); |
| 92 | 92 | $client = $this->logIn($client); |
| 93 | 93 | |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | ''); |
| 103 | 103 | |
| 104 | 104 | $response = $client->getResponse(); |
| 105 | - $this->assertEquals(204,$response->getStatusCode()); |
|
| 105 | + $this->assertEquals(204, $response->getStatusCode()); |
|
| 106 | 106 | return $badge_id; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - public function testGetUserTicket(){ |
|
| 109 | + public function testGetUserTicket() { |
|
| 110 | 110 | $schema = __DIR__.'/../../../../api/schemas/ticketList.json'; |
| 111 | 111 | |
| 112 | 112 | $client = $this->createClient(); |
@@ -2,9 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Tests; |
| 4 | 4 | |
| 5 | -use Silex\WebTestCase; |
|
| 6 | -use JsonSchema\Validator; |
|
| 7 | - |
|
| 8 | 5 | class PartTest extends WorkspaceTest |
| 9 | 6 | { |
| 10 | 7 | use AbstractAppTest; |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | $client = $this->createClient(); |
| 21 | 21 | $client = $this->logIn2($client); |
| 22 | 22 | $client->request( |
| 23 | - 'POST', |
|
| 24 | - '/api/v1/workspace/'.$id.'/part/'.$part_id.'/checkin', |
|
| 25 | - [], |
|
| 26 | - [], |
|
| 27 | - ['CONTENT_TYPE' => 'application/json'], |
|
| 28 | - ''); |
|
| 23 | + 'POST', |
|
| 24 | + '/api/v1/workspace/'.$id.'/part/'.$part_id.'/checkin', |
|
| 25 | + [], |
|
| 26 | + [], |
|
| 27 | + ['CONTENT_TYPE' => 'application/json'], |
|
| 28 | + ''); |
|
| 29 | 29 | $response = $client->getResponse(); |
| 30 | 30 | $data = $client->getResponse()->getContent(); |
| 31 | 31 | print_r("ROBAGROSSA"); |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | $client = $this->createClient(); |
| 49 | 49 | $client = $this->logIn2($client); |
| 50 | 50 | $client->request( |
| 51 | - 'DELETE', |
|
| 52 | - '/api/v1/workspace/'.$id.'/part/'.$part_id.'/checkin', |
|
| 53 | - [], |
|
| 54 | - [], |
|
| 55 | - ['CONTENT_TYPE' => 'application/json'], |
|
| 56 | - ''); |
|
| 51 | + 'DELETE', |
|
| 52 | + '/api/v1/workspace/'.$id.'/part/'.$part_id.'/checkin', |
|
| 53 | + [], |
|
| 54 | + [], |
|
| 55 | + ['CONTENT_TYPE' => 'application/json'], |
|
| 56 | + ''); |
|
| 57 | 57 | $response = $client->getResponse(); |
| 58 | 58 | |
| 59 | 59 | |
@@ -10,10 +10,10 @@ discard block |
||
| 10 | 10 | use AbstractAppTest; |
| 11 | 11 | |
| 12 | 12 | |
| 13 | - public function testPostWorkspaceCheck(){ |
|
| 13 | + public function testPostWorkspaceCheck() { |
|
| 14 | 14 | $blob = $this->testPostWorkspacePart(); |
| 15 | 15 | $id = $blob[0]; |
| 16 | - $part_id= $blob[1]; |
|
| 16 | + $part_id = $blob[1]; |
|
| 17 | 17 | |
| 18 | 18 | print_r("FANFARA!"); |
| 19 | 19 | var_dump($blob); |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | $js = json_decode($data); |
| 34 | 34 | $points = $js->points; |
| 35 | 35 | |
| 36 | - $this->assertTrue(is_numeric($points)); //TODO verificare che il numero sia adeguato ai punti attesi |
|
| 36 | + $this->assertTrue(is_numeric($points)); //TODO verificare che il numero sia adeguato ai punti attesi |
|
| 37 | 37 | |
| 38 | - return [$id,$part_id]; |
|
| 38 | + return [$id, $part_id]; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function testDeletePostWorkspaceCheck(){ |
|
| 41 | + public function testDeletePostWorkspaceCheck() { |
|
| 42 | 42 | $blob = $this->testPostWorkspaceCheck(); |
| 43 | 43 | $id = $blob[0]; |
| 44 | - $part_id= $blob[1]; |
|
| 44 | + $part_id = $blob[1]; |
|
| 45 | 45 | |
| 46 | 46 | print_r("FANFARA!"); |
| 47 | 47 | var_dump($blob); |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | $response = $client->getResponse(); |
| 58 | 58 | |
| 59 | 59 | |
| 60 | - $this->assertEquals(204,$response->getStatusCode()); //TODO verificare che il dato non sia più presente sul server |
|
| 60 | + $this->assertEquals(204, $response->getStatusCode()); //TODO verificare che il dato non sia più presente sul server |
|
| 61 | 61 | |
| 62 | - return [$id,$part_id]; |
|
| 62 | + return [$id, $part_id]; |
|
| 63 | 63 | } |
| 64 | 64 | } |