Skip to content

Commit b81bfad

Browse files
committed
Added Unit Tests.
1 parent b3b5c0c commit b81bfad

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

testing/RedUNIT/Mysql/Writer.php

+30
Original file line numberDiff line numberDiff line change
@@ -905,4 +905,34 @@ public function testTime()
905905
$time = $clock->time;
906906
asrt( ( strpos( $time, ':' ) > 0 ), TRUE );
907907
}
908+
909+
/**
910+
* Can we use the 'ignoreDisplayWidth'-feature for MySQL 8
911+
* compatibility?
912+
*
913+
* @return void
914+
*/
915+
public function testWriterFeature() {
916+
$adapter = R::getToolBox()->getDatabaseAdapter();
917+
$writer = new \RedBeanPHP\QueryWriter\MySQL( $adapter );
918+
$writer->useFeature('ignoreDisplayWidth');
919+
asrt($writer->typeno_sqltype[MySQL::C_DATATYPE_BOOL],' TINYINT UNSIGNED ');
920+
asrt($writer->typeno_sqltype[MySQL::C_DATATYPE_UINT32],' INT UNSIGNED ');
921+
asrt($writer->sqltype_typeno['tinyint unsigned'],MySQL::C_DATATYPE_BOOL);
922+
asrt($writer->sqltype_typeno['int unsigned'],MySQL::C_DATATYPE_UINT32);
923+
//Can we also pass invalid features without errors?
924+
$writer->useFeature('nonsense');
925+
pass();
926+
}
927+
928+
/**
929+
* Can we pass an options array to Writer Constructor?
930+
*
931+
* @return void
932+
*/
933+
public function testWriterOptions() {
934+
$adapter = R::getToolBox()->getDatabaseAdapter();
935+
$writer = new \RedBeanPHP\QueryWriter\MySQL( $adapter, ['noInitcode'=>TRUE] );
936+
pass();
937+
}
908938
}

0 commit comments

Comments
 (0)