mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Implement activity log test
This commit is contained in:
parent
0cc3031864
commit
d727b03d95
|
@ -230,4 +230,9 @@ class ReportTemplate extends Model
|
|||
// and return the default value if not.
|
||||
return $this->options[$fieldName] ?? '';
|
||||
}
|
||||
|
||||
public function getDisplayNameAttribute()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit\ActionLogTransformer;
|
||||
|
||||
use App\Http\Transformers\ActionlogsTransformer;
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\ReportTemplate;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ReportTemplateActionLogTransformerTest extends TestCase
|
||||
{
|
||||
public function testLogEntryForCreatingReportTemplateCanBeTransformed()
|
||||
{
|
||||
ReportTemplate::factory()->create();
|
||||
|
||||
$actionLogs = Actionlog::whereMorphedTo('item', ReportTemplate::class)->get();
|
||||
|
||||
// should be created when ActionLog is created
|
||||
$this->assertCount(1, $actionLogs);
|
||||
|
||||
$results = (new ActionlogsTransformer())->transformActionlogs($actionLogs, 10);
|
||||
|
||||
$this->assertArrayHasKey('rows', $results);
|
||||
$this->assertCount(1, $results['rows']);
|
||||
}
|
||||
|
||||
public function testLogEntryForUpdatingReportTemplateCanBeDisplayedTransformed()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testLogEntryForDeletingReportTemplateCanBeDisplayedTransformed()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testLogsScopedProperly()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
|
@ -38,11 +38,6 @@ class ReportTemplateActivityLoggingTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
public function testLogEntryForCreatingReportTemplateCanBeDisplayed()
|
||||
{
|
||||
$this->markTestIncomplete('Updates to ActionlogsTransformer needed');
|
||||
}
|
||||
|
||||
public function testUpdatingReportTemplateIsLogged()
|
||||
{
|
||||
$reportTemplate = ReportTemplate::factory()->create([
|
||||
|
@ -137,11 +132,6 @@ class ReportTemplateActivityLoggingTest extends TestCase
|
|||
]);
|
||||
}
|
||||
|
||||
public function testLogEntryForUpdatingReportTemplateCanBeDisplayedCorrectly()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testDeletingReportTemplateIsLogged()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
@ -169,14 +159,4 @@ class ReportTemplateActivityLoggingTest extends TestCase
|
|||
'item_id' => $reportTemplateB->id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function testLogEntryForDeletingReportTemplateCanBeDisplayedCorrectly()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testLogsScopedProperly()
|
||||
{
|
||||
$this->markTestIncomplete();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue