firefly-iii/tests/acceptance/Controllers/RuleGroupControllerTest.php
2016-02-04 07:30:48 +01:00

121 lines
3.4 KiB
PHP

<?php
/**
* RuleGroupControllerTest.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 RuleGroupControllerTest extends TestCase
{
/**
* @covers FireflyIII\Http\Controllers\RuleGroupController::create
* @covers FireflyIII\Http\Controllers\RuleGroupController::__construct
*/
public function testCreate()
{
$this->be($this->user());
$this->call('GET', '/rules/groups/create');
$this->assertResponseStatus(200);
}
/**
* @covers FireflyIII\Http\Controllers\RuleGroupController::delete
*/
public function testDelete()
{
$this->be($this->user());
$this->call('GET', '/rules/groups/delete/1');
$this->assertResponseStatus(200);
}
/**
* @covers FireflyIII\Http\Controllers\RuleGroupController::destroy
*/
public function testDestroy()
{
$this->session(['rules.rule-group.delete.url' => 'http://localhost']);
$this->be($this->user());
$this->call('POST', '/rules/groups/destroy/1');
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
}
/**
* @covers FireflyIII\Http\Controllers\RuleGroupController::down
*/
public function testDown()
{
$this->be($this->user());
$this->call('GET', '/rules/groups/down/1');
$this->assertResponseStatus(302);
}
/**
* @covers FireflyIII\Http\Controllers\RuleGroupController::edit
*/
public function testEdit()
{
$this->be($this->user());
$this->call('GET', '/rules/groups/edit/1');
$this->assertResponseStatus(200);
}
/**
* @covers FireflyIII\Http\Controllers\RuleGroupController::store
* @covers FireflyIII\Http\Requests\RuleGroupFormRequest::authorize
* @covers FireflyIII\Http\Requests\RuleGroupFormRequest::rules
*/
public function testStore()
{
$this->session(['rules.rule-group.create.url' => 'http://localhost']);
$args = [
'title' => 'Some new rule group',
'description' => 'New rules',
];
$this->be($this->user());
$this->call('POST', '/rules/groups/store', $args);
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
}
/**
* @covers FireflyIII\Http\Controllers\RuleGroupController::up
*/
public function testUp()
{
$this->be($this->user());
$this->call('GET', '/rules/groups/up/1');
$this->assertResponseStatus(302);
}
/**
* @covers FireflyIII\Http\Controllers\RuleGroupController::update
* @covers FireflyIII\Http\Requests\RuleGroupFormRequest::authorize
* @covers FireflyIII\Http\Requests\RuleGroupFormRequest::rules
*/
public function testUpdate()
{
$this->session(['rules.rule-group.edit.url' => 'http://localhost']);
$args = [
'id' => 1,
'title' => 'Some new rule group X',
'description' => 'New rules',
'active' => 1,
];
$this->be($this->user());
$this->call('POST', '/rules/groups/update/1', $args);
$this->assertResponseStatus(302);
$this->assertSessionHas('success');
}
}