| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * ProfileControllerTest.php | 
					
						
							|  |  |  |  * Copyright (C) 2016 Sander Dorigo | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This software may be modified and distributed under the terms | 
					
						
							|  |  |  |  * of the MIT license.  See the LICENSE file for details. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Generated by PHPUnit_SkeletonGenerator on 2016-01-19 at 15:39:28. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class ProfileControllerTest extends TestCase | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\ProfileController::changePassword | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |      * @covers FireflyIII\Http\Controllers\ProfileController::__construct | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public function testChangePassword() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  |         $this->call('GET', '/profile/change-password'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\ProfileController::deleteAccount | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testDeleteAccount() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  |         $this->call('GET', '/profile/delete-account'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\ProfileController::index | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testIndex() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  |         $this->call('GET', '/profile'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\ProfileController::postChangePassword | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |      * @covers FireflyIII\Http\Requests\ProfileFormRequest::authorize | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Requests\ProfileFormRequest::rules | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public function testPostChangePassword() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |         $args = [ | 
					
						
							|  |  |  |             'current_password'          => 'james', | 
					
						
							|  |  |  |             'new_password'              => 'sander', | 
					
						
							|  |  |  |             'new_password_confirmation' => 'sander', | 
					
						
							|  |  |  |         ]; | 
					
						
							|  |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  |         $this->call('POST', '/profile/change-password', $args); | 
					
						
							|  |  |  |         $this->assertResponseStatus(302); | 
					
						
							|  |  |  |         $this->assertSessionHas('success'); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\ProfileController::postDeleteAccount | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |      * @covers FireflyIII\Http\Requests\DeleteAccountFormRequest::authorize | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Requests\DeleteAccountFormRequest::rules | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public function testPostDeleteAccount() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |         $args = [ | 
					
						
							|  |  |  |             'password' => 'james', | 
					
						
							|  |  |  |         ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->be($this->toBeDeletedUser()); | 
					
						
							|  |  |  |         $this->call('POST', '/profile/delete-account', $args); | 
					
						
							|  |  |  |         $this->assertResponseStatus(302); | 
					
						
							|  |  |  |         $this->assertRedirectedToRoute('index'); | 
					
						
							|  |  |  |         $this->assertNull(DB::table('users')->find(3)); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } |