Testable.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * Licensed to Jasig under one or more contributor license
  4. * agreements. See the NOTICE file distributed with this work for
  5. * additional information regarding copyright ownership.
  6. *
  7. * Jasig licenses this file to you under the Apache License,
  8. * Version 2.0 (the "License"); you may not use this file except in
  9. * compliance with the License. You may obtain a copy of the License at:
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * PHP Version 5
  20. *
  21. * @file CAS/ProxiedService/Testabel.php
  22. * @category Authentication
  23. * @package PhpCAS
  24. * @author Adam Franco <afranco@middlebury.edu>
  25. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  26. * @link https://wiki.jasig.org/display/CASC/phpCAS
  27. */
  28. /**
  29. * This interface defines methods that allow proxy-authenticated service handlers
  30. * to be tested in unit tests.
  31. *
  32. * Classes implementing this interface SHOULD store the CAS_Client passed and
  33. * initialize themselves with that client rather than via the static phpCAS
  34. * method. For example:
  35. *
  36. * / **
  37. * * Fetch our proxy ticket.
  38. * * /
  39. * protected function initializeProxyTicket() {
  40. * // Allow usage of a particular CAS_Client for unit testing.
  41. * if (is_null($this->casClient))
  42. * phpCAS::initializeProxiedService($this);
  43. * else
  44. * $this->casClient->initializeProxiedService($this);
  45. * }
  46. *
  47. * @class CAS_ProxiedService_Testabel
  48. * @category Authentication
  49. * @package PhpCAS
  50. * @author Adam Franco <afranco@middlebury.edu>
  51. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  52. * @link https://wiki.jasig.org/display/CASC/phpCAS
  53. */
  54. interface CAS_ProxiedService_Testable
  55. {
  56. /**
  57. * Use a particular CAS_Client->initializeProxiedService() rather than the
  58. * static phpCAS::initializeProxiedService().
  59. *
  60. * This method should not be called in standard operation, but is needed for unit
  61. * testing.
  62. *
  63. * @param CAS_Client $casClient Cas client object
  64. *
  65. * @return void
  66. * @throws CAS_OutOfSequenceException If called after a proxy ticket has
  67. * already been initialized/set.
  68. */
  69. public function setCasClient (CAS_Client $casClient);
  70. }
  71. ?>