mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-26 21:43:53 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			146 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			146 lines
		
	
	
		
			4.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * TransactionControllerTest.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:29.
 | |
|  */
 | |
| class TransactionControllerTest extends TestCase
 | |
| {
 | |
| 
 | |
|     /**
 | |
|      * @covers FireflyIII\Http\Controllers\TransactionController::create
 | |
|      * @covers FireflyIII\Http\Controllers\TransactionController::__construct
 | |
|      */
 | |
|     public function testCreate()
 | |
|     {
 | |
|         $this->be($this->user());
 | |
|         $this->call('GET', '/transactions/create/withdrawal');
 | |
|         $this->assertResponseStatus(200);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @covers FireflyIII\Http\Controllers\TransactionController::delete
 | |
|      */
 | |
|     public function testDelete()
 | |
|     {
 | |
|         $this->be($this->user());
 | |
|         $this->call('GET', '/transaction/delete/1');
 | |
|         $this->assertResponseStatus(200);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @covers FireflyIII\Http\Controllers\TransactionController::destroy
 | |
|      */
 | |
|     public function testDestroy()
 | |
|     {
 | |
|         $this->session(['transactions.delete.url' => 'http://localhost']);
 | |
| 
 | |
|         $this->be($this->user());
 | |
|         $this->call('POST', '/transaction/destroy/1');
 | |
|         $this->assertResponseStatus(302);
 | |
|         $this->assertSessionHas('success');
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @covers FireflyIII\Http\Controllers\TransactionController::edit
 | |
|      */
 | |
|     public function testEdit()
 | |
|     {
 | |
|         $this->be($this->user());
 | |
|         $this->call('GET', '/transaction/edit/1');
 | |
|         $this->assertResponseStatus(200);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @covers FireflyIII\Http\Controllers\TransactionController::index
 | |
|      */
 | |
|     public function testIndex()
 | |
|     {
 | |
|         $this->be($this->user());
 | |
|         $this->call('GET', '/transactions/deposit');
 | |
|         $this->assertResponseStatus(200);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @covers FireflyIII\Http\Controllers\TransactionController::reorder
 | |
|      */
 | |
|     public function testReorder()
 | |
|     {
 | |
|         $args = [
 | |
|             'ids'  => [1],
 | |
|             'date' => '2015-01-01',
 | |
|         ];
 | |
|         $this->be($this->user());
 | |
|         $this->call('POST', '/transaction/reorder', $args);
 | |
|         $this->assertResponseStatus(200);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @covers FireflyIII\Http\Controllers\TransactionController::show
 | |
|      */
 | |
|     public function testShow()
 | |
|     {
 | |
|         $this->be($this->user());
 | |
|         $this->call('GET', '/transaction/show/1');
 | |
|         $this->assertResponseStatus(200);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @covers FireflyIII\Http\Controllers\TransactionController::store
 | |
|      * @covers FireflyIII\Http\Requests\JournalFormRequest::authorize
 | |
|      * @covers FireflyIII\Http\Requests\JournalFormRequest::rules
 | |
|      * @covers FireflyIII\Http\Requests\JournalFormRequest::getJournalData
 | |
|      */
 | |
|     public function testStore()
 | |
|     {
 | |
|         $this->session(['transactions.create.url' => 'http://localhost']);
 | |
| 
 | |
|         $args = [
 | |
|             'what'                      => 'withdrawal',
 | |
|             'description'               => 'Something',
 | |
|             'account_id'                => '1',
 | |
|             'expense_account'           => 'Some expense',
 | |
|             'amount'                    => 100,
 | |
|             'amount_currency_id_amount' => 1,
 | |
|             'date'                      => '2015-01-01',
 | |
|         ];
 | |
|         $this->be($this->user());
 | |
|         $this->call('POST', '/transactions/store/withdrawal', $args);
 | |
|         $this->assertResponseStatus(302);
 | |
|         $this->assertSessionHas('success');
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @covers FireflyIII\Http\Controllers\TransactionController::update
 | |
|      * @covers FireflyIII\Http\Requests\JournalFormRequest::authorize
 | |
|      * @covers FireflyIII\Http\Requests\JournalFormRequest::rules
 | |
|      * @covers FireflyIII\Http\Requests\JournalFormRequest::getJournalData
 | |
|      */
 | |
|     public function testUpdate()
 | |
|     {
 | |
|         $this->session(['transactions.edit.url' => 'http://localhost']);
 | |
| 
 | |
|         $args = [
 | |
|             'what'                      => 'withdrawal',
 | |
|             'id'                        => 2,
 | |
|             'description'               => 'Something new',
 | |
|             'account_id'                => '1',
 | |
|             'expense_account'           => 'Some expense',
 | |
|             'amount'                    => 100,
 | |
|             'amount_currency_id_amount' => 1,
 | |
|             'date'                      => '2015-01-01',
 | |
|         ];
 | |
|         $this->be($this->user());
 | |
|         $this->call('POST', '/transaction/update/1', $args);
 | |
|         $this->assertResponseStatus(302);
 | |
|         $this->assertSessionHas('success');
 | |
|     }
 | |
| }
 |