document_pdf_options_tests.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?php
  2. /**
  3. * ezcDocTestConvertXhtmlDocbook
  4. *
  5. * Licensed to the Apache Software Foundation (ASF) under one
  6. * or more contributor license agreements. See the NOTICE file
  7. * distributed with this work for additional information
  8. * regarding copyright ownership. The ASF licenses this file
  9. * to you under the Apache License, Version 2.0 (the
  10. * "License"); you may not use this file except in compliance
  11. * with the License. You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing,
  16. * software distributed under the License is distributed on an
  17. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  18. * KIND, either express or implied. See the License for the
  19. * specific language governing permissions and limitations
  20. * under the License.
  21. *
  22. * @package Document
  23. * @version //autogen//
  24. * @subpackage Tests
  25. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  26. */
  27. require_once dirname( __FILE__ ) . '/options_test_case.php';
  28. /**
  29. * Test suite for class.
  30. *
  31. * @package Document
  32. * @subpackage Tests
  33. */
  34. class ezcDocumentPdfOptionsTests extends ezcDocumentOptionsTestCase
  35. {
  36. public static function suite()
  37. {
  38. return new PHPUnit_Framework_TestSuite( __CLASS__ );
  39. }
  40. protected function getOptionsClassName()
  41. {
  42. return 'ezcDocumentPdfOptions';
  43. }
  44. public static function provideDefaultValues()
  45. {
  46. return array(
  47. array(
  48. 'errorReporting', 15,
  49. ),
  50. array(
  51. 'hyphenator', new ezcDocumentPdfDefaultHyphenator(),
  52. ),
  53. array(
  54. 'tokenizer', new ezcDocumentPdfDefaultTokenizer(),
  55. ),
  56. array(
  57. 'tableColumnWidthCalculator', new ezcDocumentPdfDefaultTableColumnWidthCalculator(),
  58. ),
  59. array(
  60. 'driver', null,
  61. ),
  62. array(
  63. 'compress', false,
  64. ),
  65. array(
  66. 'ownerPassword', null,
  67. ),
  68. array(
  69. 'userPassword', null,
  70. ),
  71. array(
  72. 'permissions', -1,
  73. ),
  74. );
  75. }
  76. public static function provideValidData()
  77. {
  78. return array(
  79. array(
  80. 'errorReporting',
  81. array( E_PARSE, E_PARSE | E_NOTICE ),
  82. ),
  83. array(
  84. 'hyphenator',
  85. array( new ezcDocumentPdfDefaultHyphenator() ),
  86. ),
  87. array(
  88. 'tokenizer',
  89. array( new ezcDocumentPdfDefaultTokenizer() ),
  90. ),
  91. array(
  92. 'tableColumnWidthCalculator',
  93. array( new ezcDocumentPdfDefaultTableColumnWidthCalculator() ),
  94. ),
  95. array(
  96. 'driver',
  97. array( new ezcDocumentPdfHaruDriver() ),
  98. ),
  99. array(
  100. 'compress',
  101. array( true, false ),
  102. ),
  103. array(
  104. 'ownerPassword',
  105. array( 'foo', null ),
  106. ),
  107. array(
  108. 'userPassword',
  109. array( null ),
  110. ),
  111. array(
  112. 'permissions',
  113. array( 0, -1, ezcDocumentPdfOptions::EDIT | ezcDocumentPdfOptions::PRINTABLE ),
  114. ),
  115. );
  116. }
  117. public static function provideInvalidData()
  118. {
  119. return array(
  120. array(
  121. 'errorReporting',
  122. array( 'foo', E_ALL & ~E_PARSE ),
  123. ),
  124. array(
  125. 'hyphenator',
  126. array( 'foo', new StdClass() ),
  127. ),
  128. array(
  129. 'tokenizer',
  130. array( 'foo', new StdClass() ),
  131. ),
  132. array(
  133. 'tableColumnWidthCalculator',
  134. array( 'foo', new StdClass() ),
  135. ),
  136. array(
  137. 'driver',
  138. array( 'foo', new StdClass() ),
  139. ),
  140. array(
  141. 'compress',
  142. array( 1, null, 23.4, 'foo', new StdClass() ),
  143. ),
  144. array(
  145. 'ownerPassword',
  146. array( 1, 23.4, new StdClass() ),
  147. ),
  148. array(
  149. 'userPassword',
  150. array( 'foo', 1, 23.4, new StdClass() ),
  151. ),
  152. array(
  153. 'permissions',
  154. array( null, 23.4, 'foo', new StdClass() ),
  155. ),
  156. );
  157. }
  158. }
  159. ?>