| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * BudgetControllerTest.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:27. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class BudgetControllerTest extends TestCase | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::amount | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::__construct | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-05 06:36:56 +01:00
										 |  |  |     public function testAmount($range) | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $args = [ | 
					
						
							|  |  |  |             'amount' => 1200, | 
					
						
							|  |  |  |         ]; | 
					
						
							|  |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('POST', '/budgets/amount/1', $args); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::create | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testCreate() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/budgets/create'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::delete | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testDelete() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/budgets/delete/1'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::destroy | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testDestroy() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->session(['budgets.delete.url' => 'http://localhost']); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('POST', '/budgets/destroy/2'); | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->assertSessionHas('success'); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->assertResponseStatus(302); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::edit | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testEdit() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/budgets/edit/1'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::index | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-05 06:36:56 +01:00
										 |  |  |     public function testIndex($range) | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/budgets'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::noBudget | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-05 06:36:56 +01:00
										 |  |  |     public function testNoBudget($range) | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/budgets/list/noBudget'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::postUpdateIncome | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-05 06:36:56 +01:00
										 |  |  |     public function testPostUpdateIncome($range) | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $args = [ | 
					
						
							|  |  |  |             'amount' => 1200, | 
					
						
							|  |  |  |         ]; | 
					
						
							|  |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('POST', '/budgets/income', $args); | 
					
						
							|  |  |  |         $this->assertResponseStatus(302); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::show | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-05 06:36:56 +01:00
										 |  |  |     public function testShow($range) | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/budgets/show/1'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::store | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |      * @covers FireflyIII\Http\Requests\BudgetFormRequest::authorize | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Requests\BudgetFormRequest::rules | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public function testStore() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  |         $this->session(['budgets.create.url' => 'http://localhost']); | 
					
						
							|  |  |  |         $args = [ | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |             'name' => 'Some kind of test budget.', | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('POST', '/budgets/store', $args); | 
					
						
							|  |  |  |         $this->assertResponseStatus(302); | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->assertSessionHas('success'); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::update | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |      * @covers FireflyIII\Http\Requests\BudgetFormRequest::authorize | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Requests\BudgetFormRequest::rules | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public function testUpdate() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  |         $this->session(['budgets.edit.url' => 'http://localhost']); | 
					
						
							|  |  |  |         $args = [ | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |             'name' => 'Some kind of test budget.', | 
					
						
							|  |  |  |             'id'   => 1, | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('POST', '/budgets/update/1', $args); | 
					
						
							|  |  |  |         $this->assertResponseStatus(302); | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->assertSessionHas('success'); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\BudgetController::updateIncome | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-05 06:36:56 +01:00
										 |  |  |     public function testUpdateIncome($range) | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-20 16:15:23 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/budgets/income'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } |