File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed
lib/internal/Magento/Framework/DB/Test/Unit/Adapter/Pdo Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -852,6 +852,64 @@ public function columnDataForTest(): array
852
852
];
853
853
}
854
854
855
+ /**
856
+ * @param array $actual
857
+ * @param mixed $expected
858
+ * @dataProvider columnDataAndValueForTest
859
+ * @return void
860
+ * @throws \ReflectionException
861
+ */
862
+ public function testPrepareColumnValue (array $ actual , mixed $ expected )
863
+ {
864
+ $ adapter = $ this ->getMysqlPdoAdapterMock ([]);
865
+
866
+ $ result = $ this ->invokeModelMethod ($ adapter , 'prepareColumnValue ' , [$ actual [0 ], $ actual [1 ]]);
867
+
868
+ $ this ->assertEquals ($ expected , $ result );
869
+ }
870
+
871
+ /**
872
+ * Data provider for testPrepareColumnValue
873
+ *
874
+ * @return array[]
875
+ */
876
+ public function columnDataAndValueForTest (): array
877
+ {
878
+ return [
879
+ [
880
+ 'actual ' => [
881
+ [
882
+ 'DATA_TYPE ' => 'int ' ,
883
+ 'DEFAULT ' => ''
884
+ ],
885
+ '10 '
886
+ ],
887
+ 'expected ' => 10
888
+ ],
889
+ [
890
+ 'actual ' => [
891
+ [
892
+ 'DATA_TYPE ' => 'timestamp /* mariadb-5.3 */ ' ,
893
+ 'DEFAULT ' => 'CURRENT_TIMESTAMP '
894
+ ],
895
+ 'null '
896
+ ],
897
+ 'expected ' => new \Zend_Db_Expr ('NULL ' )
898
+ ],
899
+ [
900
+ 'actual ' => [
901
+ [
902
+ 'DATA_TYPE ' => 'varchar ' ,
903
+ 'NULLABLE ' => false ,
904
+ 'DEFAULT ' => ''
905
+ ],
906
+ 10
907
+ ],
908
+ 'expected ' => '10 '
909
+ ]
910
+ ];
911
+ }
912
+
855
913
/**
856
914
* @param string $method
857
915
* @param array $parameters
You can’t perform that action at this time.
0 commit comments