mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Include a batch of naughty strings to see what happens to Firefly.
This commit is contained in:
@@ -84,16 +84,6 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
@@ -104,6 +94,33 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function naughtyStringProvider()
|
||||
{
|
||||
|
||||
$path = realpath(__DIR__ . '/../resources/tests/blns.base64.json');
|
||||
$content = file_get_contents($path);
|
||||
$array = json_decode($content);
|
||||
$return = [];
|
||||
foreach ($array as $entry) {
|
||||
$return[] = [base64_decode($entry)];
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
|
||||
@@ -85,7 +85,7 @@ class SingleControllerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::store
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::store
|
||||
*/
|
||||
public function testStore()
|
||||
{
|
||||
@@ -99,13 +99,36 @@ class SingleControllerTest extends TestCase
|
||||
'source_account_id' => 1,
|
||||
'destination_account_name' => 'Some destination',
|
||||
'date' => '2016-01-01',
|
||||
'description' => 'Some description',
|
||||
'description' => 'Test descr',
|
||||
];
|
||||
$this->call('post', route('transactions.store', ['withdrawal']), $data);
|
||||
$this->assertResponseStatus(302);
|
||||
$this->assertSessionHas('success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::store
|
||||
* @dataProvider naughtyStringProvider
|
||||
*/
|
||||
public function testStoreNaughty(string $description)
|
||||
{
|
||||
$this->session(['transactions.create.url' => 'http://localhost']);
|
||||
$this->be($this->user());
|
||||
|
||||
$data = [
|
||||
'what' => 'withdrawal',
|
||||
'amount' => '10',
|
||||
'amount_currency_id_amount' => 1,
|
||||
'source_account_id' => 1,
|
||||
'destination_account_name' => 'Some destination',
|
||||
'date' => '2016-01-01',
|
||||
'description' => $description,
|
||||
];
|
||||
$response = $this->call('post', route('transactions.store', ['withdrawal']), $data);
|
||||
$this->assertNotEquals($response->getStatusCode(), 500);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Transaction\SingleController::update
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user