File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 1515use OCP \Files \AppData \IAppDataFactory ;
1616use OCP \Files \IAppData ;
1717use OCP \Files \NotFoundException ;
18+ use OCP \IL10N ;
1819use Psr \Log \LoggerInterface ;
1920use Symfony \Component \Uid \Uuid ;
2021
@@ -26,6 +27,7 @@ public function __construct(
2627 private readonly IAppConfig $ appConfig ,
2728 private readonly LoggerInterface $ logger ,
2829 private readonly CardDavBackend $ cardDav ,
30+ private readonly IL10N $ l ,
2931 ) {
3032 $ this ->appData = $ appDataFactory ->get (Application::APP_ID );
3133 }
@@ -131,6 +133,9 @@ public function createDefaultContact(int $addressBookId): void {
131133 } else {
132134 $ vcard ->add ('REV ' , $ newRev );
133135 }
136+ if (!$ vcard ->Note ) {
137+ $ vcard ->add ('note ' , $ this ->l ->t ('This is an example contact ' ));
138+ }
134139
135140 // Level 3 means that the document is invalid
136141 // https://sabre.io/vobject/vcard/#validating-vcard
Original file line number Diff line number Diff line change 1818use OCP \Files \NotFoundException ;
1919use OCP \Files \SimpleFS \ISimpleFile ;
2020use OCP \Files \SimpleFS \ISimpleFolder ;
21+ use OCP \IL10N ;
2122use PHPUnit \Framework \MockObject \MockObject ;
2223use Psr \Log \LoggerInterface ;
2324use Symfony \Component \Uid \Uuid ;
@@ -31,6 +32,7 @@ class ExampleContactServiceTest extends TestCase {
3132 protected LoggerInterface &MockObject $ logger ;
3233 protected IAppConfig &MockObject $ appConfig ;
3334 protected IAppData &MockObject $ appData ;
35+ protected IL10N &MockObject $ l ;
3436
3537 protected function setUp (): void {
3638 parent ::setUp ();
@@ -39,6 +41,7 @@ protected function setUp(): void {
3941 $ this ->appDataFactory = $ this ->createMock (IAppDataFactory::class);
4042 $ this ->logger = $ this ->createMock (LoggerInterface::class);
4143 $ this ->appConfig = $ this ->createMock (IAppConfig::class);
44+ $ this ->l = $ this ->createMock ((IL10N ::class));
4245
4346 $ this ->appData = $ this ->createMock (IAppData::class);
4447 $ this ->appDataFactory ->method ('get ' )
@@ -50,6 +53,7 @@ protected function setUp(): void {
5053 $ this ->appConfig ,
5154 $ this ->logger ,
5255 $ this ->cardDav ,
56+ $ this ->l ,
5357 );
5458 }
5559
You can’t perform that action at this time.
0 commit comments