Maintain local ⭤ remote in sync with automatic AT Protocol parity for Laravel (alpha & unstable)
at dev 38 lines 782 B view raw
1<?php 2 3namespace SocialDept\AtpParity\Tests\Fixtures; 4 5use Illuminate\Database\Eloquent\Model; 6use SocialDept\AtpParity\RecordMapper; 7use SocialDept\AtpSchema\Data\Data; 8 9/** 10 * Test mapper for unit testing. 11 */ 12class TestMapper extends RecordMapper 13{ 14 public function recordClass(): string 15 { 16 return TestRecord::class; 17 } 18 19 public function modelClass(): string 20 { 21 return TestModel::class; 22 } 23 24 protected function recordToAttributes(Data $record): array 25 { 26 return [ 27 'content' => $record->text, 28 ]; 29 } 30 31 protected function modelToRecordData(Model $model): array 32 { 33 return [ 34 'text' => $model->content, 35 'createdAt' => $model->created_at?->toIso8601String(), 36 ]; 37 } 38}