ExtendsTest.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace JsonSchema\Tests;
  3. class ExtendsTest extends BaseTestCase
  4. {
  5. public function getInvalidTests()
  6. {
  7. return array(
  8. array(
  9. '{
  10. "name":"bruno",
  11. "age":50
  12. }',
  13. '{
  14. "id": "person",
  15. "type": "object",
  16. "properties": {
  17. "name": {
  18. "type": "string"
  19. },
  20. "age" : {
  21. "type": "integer",
  22. "maximum":120
  23. }
  24. },
  25. "extends": {
  26. "id": "oldPerson",
  27. "type": "object",
  28. "properties": {
  29. "age" : {"minimum":70}
  30. }
  31. }
  32. }'
  33. ),
  34. array(
  35. '{
  36. "name":"bruno",
  37. "age":180
  38. }',
  39. '{
  40. "id": "person",
  41. "type": "object",
  42. "properties": {
  43. "name": {
  44. "type": "string"
  45. },
  46. "age" : {
  47. "type": "integer",
  48. "maximum":120
  49. }
  50. },
  51. "extends": {
  52. "id": "oldPerson",
  53. "type": "object",
  54. "properties": {
  55. "age" : {"minimum":70}
  56. }
  57. }
  58. }'
  59. )
  60. );
  61. }
  62. public function getValidTests()
  63. {
  64. return array(
  65. array(
  66. '{
  67. "name":"bruno",
  68. "age":80
  69. }',
  70. '{
  71. "id": "person",
  72. "type": "object",
  73. "properties": {
  74. "name": {
  75. "type": "string"
  76. },
  77. "age" : {
  78. "type": "integer",
  79. "maximum":120
  80. }
  81. },
  82. "extends": {
  83. "id": "oldPerson",
  84. "type": "object",
  85. "properties": {
  86. "age" : {"minimum":70}
  87. }
  88. }
  89. }'
  90. )
  91. );
  92. }
  93. }