File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
app/code/Magento/AwsS3/Test/Unit/Driver Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -537,4 +537,42 @@ public function testFileCloseShouldReturnFalseIfTheArgumentIsNotAResource(): voi
537
537
$ this ->assertEquals (false , $ this ->driver ->fileClose (null ));
538
538
$ this ->assertEquals (false , $ this ->driver ->fileClose (false ));
539
539
}
540
+
541
+ /**
542
+ * @dataProvider fileOpenModesDataProvider
543
+ */
544
+ public function testFileOppenedMode ($ mode , $ expected ): void
545
+ {
546
+ $ this ->adapterMock ->method ('fileExists ' )->willReturn (true );
547
+ if ($ mode !== 'w ' ) {
548
+ $ this ->adapterMock ->expects ($ this ->once ())->method ('read ' )->willReturn ('aaa ' );
549
+ } else {
550
+ $ this ->adapterMock ->expects ($ this ->never ())->method ('read ' );
551
+ }
552
+ $ resource = $ this ->driver ->fileOpen ('test/path ' , $ mode );
553
+ $ this ->assertEquals ($ expected , ftell ($ resource ));
554
+ }
555
+
556
+ /**
557
+ * Data provider for testFileOppenedMode
558
+ *
559
+ * @return array[]
560
+ */
561
+ public function fileOpenModesDataProvider (): array
562
+ {
563
+ return [
564
+ [
565
+ "mode " => "a " ,
566
+ "expected " => 3
567
+ ],
568
+ [
569
+ "mode " => "r " ,
570
+ "expected " => 0
571
+ ],
572
+ [
573
+ "mode " => "w " ,
574
+ "expected " => 0
575
+ ]
576
+ ];
577
+ }
540
578
}
You can’t perform that action at this time.
0 commit comments