Fix some tests, disable actions for the time being.

This commit is contained in:
James Cole
2020-08-01 15:06:02 +02:00
parent a6a83286b9
commit 723d1cffe2
8 changed files with 347 additions and 162 deletions

View File

@@ -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);
}