Newer
Older
sqlmarker / UsedCars / Test_classes / Sales / UsedCars_Test_Sales.php
  1. <?php
  2. require_once "Schema.php";
  3.  
  4. abstract class UsedCars_Test_Sales extends PHPUnit_Extensions_Database_TestCase_CreateTable
  5. {
  6. public function getTableName()
  7. {
  8. return 'SALES';
  9. }
  10. public function getColumnList()
  11. {
  12. return array(
  13. // No need to test legal values because of the FK. If the FK is missing it's broken anyway!
  14. 'STAFF_ID' => array( 'generic_type' => 'NUMBER',
  15. 'sql_type' => array( 'NUMBER', 'INTEGER' ),
  16. 'min_length' => 4,
  17. 'max_length' => 4,
  18. 'decimals' => 0,
  19. 'nullable' => false,
  20. 'aliases' => array( 'SALES_ID', 'SALES_STAFF_ID', 'SALESREP_ID' ),
  21. 'test_value' => '4571', ), // Has to be an unused Person_ID in the fixture because of the FK.
  22. 'ON_COMMISSION' => array( 'generic_type' => 'TEXT',
  23. 'sql_type' => array( 'CHAR', 'VARCHAR2', 'VARCHAR' ),
  24. 'min_length' => 1,
  25. 'nullable' => false,
  26. 'default' => FALSE_VALUE,
  27. 'legal_values' => array( TRUE_VALUE, FALSE_VALUE ),
  28. // 'f', 'F', 'false', 'False', 'FALSE', 'n', 'N', 'no', 'No', 'NO', '0',
  29. // 't', 'T', 'true', 'True', 'TRUE', 'y', 'Y', 'yes', 'Yes', 'YES', '1', ),
  30. 'illegal_values'=> array( ' ', 'X', '9', '@' ),
  31. 'test_value' => TRUE_VALUE, ),
  32. 'COMMISSION_RATE' => array( 'generic_type' => 'NUMBER',
  33. 'sql_type' => array( 'NUMBER', 'DECIMAL' ),
  34. 'min_length' => 2,
  35. 'max_length' => 3,
  36. 'decimals' => 2,
  37. 'underflow' => -0.01,
  38. 'overflow' => 0.31,
  39. 'legal_values' => array( 0, 0.1, 0.25, 0.3 ),
  40. 'illegal_values'=> array( -9.99, -1, 1.54, 9.99 ),
  41. 'nullable' => false,
  42. 'test_value' => 0.2, ),
  43. 'GROSS_EARNINGS' => array( 'generic_type' => 'NUMBER',
  44. 'sql_type' => array( 'NUMBER', 'DECIMAL' ),
  45. 'min_length' => 8,
  46. 'decimals' => 2,
  47. 'underflow' => -0.01,
  48. 'legal_values' => array( 0, 1, 10.27, 100.38, 1000.49, 100000.51, 999999.99 ),
  49. 'illegal_values'=> array( -10 ),
  50. 'nullable' => false,
  51. 'test_value' => 12345.67, ),
  52. );
  53. }
  54. public function getPKColumnList()
  55. {
  56. return array( 'STAFF_ID' );
  57. }
  58. public function getFKColumnList()
  59. {
  60. return array( 'STAFF' => array( 'STAFF_ID' ) );
  61. }
  62. public function getUniqueColumnList()
  63. {
  64. return array();
  65. }
  66. }
  67. ?>