| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * CurrencyControllerTest.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 CurrencyControllerTest extends TestCase | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\CurrencyController::create | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |      * @covers FireflyIII\Http\Controllers\CurrencyController::__construct | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public function testCreate() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/currency/create'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\CurrencyController::defaultCurrency | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testDefaultCurrency() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/currency/default/2'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(302); | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->assertRedirectedToRoute('currency.index'); | 
					
						
							|  |  |  |         $this->assertSessionHas('success'); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\CurrencyController::delete | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testDelete() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/currency/delete/2'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\CurrencyController::destroy | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testDestroy() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->session(['currency.delete.url' => 'http://localhost/currency']); | 
					
						
							|  |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('POST', '/currency/destroy/3'); | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->assertSessionHas('success'); | 
					
						
							|  |  |  |         $this->assertRedirectedToRoute('currency.index'); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->assertResponseStatus(302); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\CurrencyController::edit | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function testEdit() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/currency/edit/2'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\CurrencyController::index | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2016-02-05 06:36:56 +01:00
										 |  |  |     public function testIndex($range) | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('GET', '/currency'); | 
					
						
							|  |  |  |         $this->assertResponseStatus(200); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\CurrencyController::store | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |      * @covers FireflyIII\Http\Requests\CurrencyFormRequest::authorize | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Requests\CurrencyFormRequest::rules | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Requests\CurrencyFormRequest::getCurrencyData | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public function testStore() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  |         $this->session(['currency.create.url' => 'http://localhost/currency']); | 
					
						
							|  |  |  |         $args = [ | 
					
						
							|  |  |  |             'name'   => 'New Euro.', | 
					
						
							|  |  |  |             'symbol' => 'Y', | 
					
						
							|  |  |  |             'code'   => 'IUY', | 
					
						
							|  |  |  |         ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('POST', '/currency/store', $args); | 
					
						
							|  |  |  |         $this->assertResponseStatus(302); | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->assertSessionHas('success'); | 
					
						
							|  |  |  |         $this->assertRedirectedToRoute('currency.index'); | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Controllers\CurrencyController::update | 
					
						
							| 
									
										
										
										
											2016-02-04 07:30:48 +01:00
										 |  |  |      * @covers FireflyIII\Http\Requests\CurrencyFormRequest::authorize | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Requests\CurrencyFormRequest::rules | 
					
						
							|  |  |  |      * @covers FireflyIII\Http\Requests\CurrencyFormRequest::getCurrencyData | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |      */ | 
					
						
							|  |  |  |     public function testUpdate() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->session(['currency.edit.url' => 'http://localhost/currency']); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $args = [ | 
					
						
							|  |  |  |             'id'     => 1, | 
					
						
							|  |  |  |             'name'   => 'New Euro.', | 
					
						
							|  |  |  |             'symbol' => 'Y', | 
					
						
							|  |  |  |             'code'   => 'IUY', | 
					
						
							|  |  |  |         ]; | 
					
						
							|  |  |  |         $this->be($this->user()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-24 18:11:57 +01:00
										 |  |  |         $this->call('POST', '/currency/update/1', $args); | 
					
						
							|  |  |  |         $this->assertResponseStatus(302); | 
					
						
							| 
									
										
										
										
											2016-01-23 16:48:34 +01:00
										 |  |  |         $this->assertSessionHas('success'); | 
					
						
							|  |  |  |         $this->assertRedirectedToRoute('currency.index'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-20 06:20:09 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | } |