mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Implement activity logging transformer tests
This commit is contained in:
parent
20dab4d89d
commit
4aedbb52fa
|
@ -28,16 +28,41 @@ class ReportTemplateActionLogTransformerTest extends TestCase
|
||||||
|
|
||||||
public function testLogEntryForUpdatingReportTemplateCanBeDisplayedTransformed()
|
public function testLogEntryForUpdatingReportTemplateCanBeDisplayedTransformed()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$reportTemplate = ReportTemplate::factory()->create();
|
||||||
|
|
||||||
|
$reportTemplate->update([
|
||||||
|
'options' => ['new' => 'value']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$actionLogs = Actionlog::query()
|
||||||
|
->whereMorphedTo('item', ReportTemplate::class)
|
||||||
|
->where('action_type', 'update')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$this->assertCount(1, $actionLogs);
|
||||||
|
|
||||||
|
$results = (new ActionlogsTransformer())->transformActionlogs($actionLogs, 10);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('rows', $results);
|
||||||
|
$this->assertCount(1, $results['rows']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLogEntryForDeletingReportTemplateCanBeDisplayedTransformed()
|
public function testLogEntryForDeletingReportTemplateCanBeDisplayedTransformed()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$reportTemplate = ReportTemplate::factory()->create();
|
||||||
}
|
|
||||||
|
|
||||||
public function testLogsScopedProperly()
|
$reportTemplate->delete();
|
||||||
{
|
|
||||||
$this->markTestIncomplete();
|
$actionLogs = Actionlog::query()
|
||||||
|
->whereMorphedTo('item', ReportTemplate::class)
|
||||||
|
->where('action_type', 'delete')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$this->assertCount(1, $actionLogs);
|
||||||
|
|
||||||
|
$results = (new ActionlogsTransformer())->transformActionlogs($actionLogs, 10);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('rows', $results);
|
||||||
|
$this->assertCount(1, $results['rows']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue