unit testing - Workaround for CakePHP tests with enums? -


I try to make unit tests for the KPPHP project. After making the fixtures, I go into problems with some tests:

WARNING: Column type ENUM ('on', 'off') /app/cake/2.4.7/Cake/ Does not exist

Application error: Handler method called 'PDOException' with message 'SQLSTATE [42S22] Exception: Columns not found: 1054 Unknown column in' state list '/app/cake/2.4.7/ Cake / Model / Datasource / DboSource.php2923

I know that KHHP does not support Enum but I can not change the datatype. Is there any way to run with unit testing enums?

I ran into the same problem to resolve I made a sub-class that is the classification of the classified class And overrides the creation of tables to mimic the strings to all enum areas.

  & lt ;? Php class MyTestFixtureCakeTestFixt * * 64 * / Create a field of enum fields in the database with the length of the function (& amp; $ db) {foreach ($ this- & gt; field as $ name = & gt; & amp; $ field ) {If (strstr ($ area ['type'], "enum")! == incorrect) {$ field ['type'] = 'string'; $ Field ['length'] = 64; }} Parent :: create ($ db); }}   

To use it, expand this class in your class against the protest against ketstefhesek.

  & lt ;? Php App :: Usage ('MyTestFixture', 'Anywhere You Patch'); Class MyTableFixture offers MyTestFixture {public $ import = array ('model' = & gt; 'MyTable'); }    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -