mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-19 08:00:19 +00:00
Fix some tests, disable actions for the time being.
This commit is contained in:
@@ -34,9 +34,6 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class AttachmentFactoryTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class AttachmentFactoryTest extends TestCase
|
||||
{
|
||||
@@ -46,9 +43,6 @@ class AttachmentFactoryTest extends TestCase
|
||||
*/
|
||||
public function setUp(): void
|
||||
{
|
||||
self::markTestIncomplete('Incomplete for refactor.');
|
||||
|
||||
return;
|
||||
parent::setUp();
|
||||
Log::info(sprintf('Now in %s.', get_class($this)));
|
||||
}
|
||||
@@ -85,12 +79,12 @@ class AttachmentFactoryTest extends TestCase
|
||||
/**
|
||||
* @covers \FireflyIII\Factory\AttachmentFactory
|
||||
*/
|
||||
public function testCreateTransaction(): void
|
||||
public function testCreateWithTransaction(): void
|
||||
{
|
||||
|
||||
$journal = $this->getRandomWithdrawal();
|
||||
$journal = $this->getRandomWithdrawal();
|
||||
$transaction = $journal->transactions()->first();
|
||||
$data = [
|
||||
$data = [
|
||||
'model_id' => $transaction->id,
|
||||
'model' => Transaction::class,
|
||||
'filename' => 'testfile.pdf',
|
||||
@@ -107,40 +101,8 @@ class AttachmentFactoryTest extends TestCase
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
$this->assertEquals($data['title'], $result->title);
|
||||
$this->assertEquals($result->attachable_id, $journal->id);
|
||||
$this->assertEquals(1, $result->notes()->count());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Factory\AttachmentFactory
|
||||
*/
|
||||
public function testCreateTransactionAppendModel(): void
|
||||
{
|
||||
|
||||
$journal = $this->getRandomWithdrawal();
|
||||
$transaction = $journal->transactions()->first();
|
||||
$data = [
|
||||
'model_id' => $transaction->id,
|
||||
'model' => 'Transaction',
|
||||
'filename' => 'testfile.pdf',
|
||||
'title' => 'File name',
|
||||
'notes' => 'Some notes',
|
||||
];
|
||||
|
||||
/** @var AttachmentFactory $factory */
|
||||
$factory = app(AttachmentFactory::class);
|
||||
$factory->setUser($this->user());
|
||||
try {
|
||||
$result = $factory->create($data);
|
||||
} catch (FireflyException $e) {
|
||||
$this->assertTrue(false, $e->getMessage());
|
||||
}
|
||||
$this->assertEquals($data['title'], $result->title);
|
||||
$this->assertEquals($result->attachable_id, $journal->id);
|
||||
$this->assertEquals(1, $result->notes()->count());
|
||||
$this->assertEquals($journal->id, $result->attachable_id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user