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