OfflineConferenceCallTest.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Service_DeveloperGarden
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. if (!defined('PHPUnit_MAIN_METHOD')) {
  23. define('PHPUnit_MAIN_METHOD', 'Zend_Service_DeveloperGarden_ConferenceCallTest::main');
  24. }
  25. /**
  26. * Test helper
  27. */
  28. require_once dirname(__FILE__) . '/../../../TestHelper.php';
  29. /**
  30. * @see Zend_Service_DeveloperGarden_ConferenceCall
  31. */
  32. require_once 'Zend/Service/DeveloperGarden/ConferenceCall.php';
  33. /**
  34. * Zend_Service_DeveloperGarden test case
  35. *
  36. * @category Zend
  37. * @package Zend_Service_DeveloperGarden
  38. * @subpackage UnitTests
  39. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  40. * @license http://framework.zend.com/license/new-bsd New BSD License
  41. * @version $Id$
  42. */
  43. class Zend_Service_DeveloperGarden_OfflineConferenceCallTest extends PHPUnit_Framework_TestCase
  44. {
  45. /**
  46. * @var Zend_Service_DeveloperGarden_ConferenceCall
  47. */
  48. protected $_service = null;
  49. public static function main()
  50. {
  51. $suite = new PHPUnit_Framework_TestSuite(__CLASS__);
  52. PHPUnit_TextUI_TestRunner::run($suite);
  53. }
  54. public function setUp()
  55. {
  56. if (!defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN')) {
  57. define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN', 'Unknown');
  58. }
  59. if (!defined('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD')) {
  60. define('TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD', 'Unknown');
  61. }
  62. $config = array(
  63. 'username' => TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_LOGIN,
  64. 'password' => TESTS_ZEND_SERVICE_DEVELOPERGARDEN_ONLINE_PASSWORD,
  65. 'environment' => Zend_Service_DeveloperGarden_OfflineConferenceCall_Mock::ENV_MOCK
  66. );
  67. $this->service = new Zend_Service_DeveloperGarden_OfflineConferenceCall_Mock($config);
  68. }
  69. public function testConferenceDetailObject()
  70. {
  71. $o = new Zend_Service_DeveloperGarden_ConferenceCall_ConferenceDetail(
  72. 'My Name',
  73. 'This is the Conference Description',
  74. 300
  75. );
  76. $this->assertEquals(
  77. 'My Name',
  78. $o->getName()
  79. );
  80. $this->assertEquals(
  81. 'This is the Conference Description',
  82. $o->getDescription()
  83. );
  84. $this->assertEquals(
  85. 300,
  86. $o->getDuration()
  87. );
  88. }
  89. public function testConferenceScheduleObject()
  90. {
  91. $o = new Zend_Service_DeveloperGarden_ConferenceCall_ConferenceSchedule(
  92. 0,
  93. 1,
  94. 2,
  95. 3,
  96. 2010,
  97. 4,
  98. false
  99. );
  100. $this->assertEquals(0, $o->getMinute());
  101. $this->assertEquals(1, $o->getHour());
  102. $this->assertEquals(2, $o->getDayOfMonth());
  103. $this->assertEquals(3, $o->getMonth());
  104. $this->assertEquals(2010,$o->getYear());
  105. $this->assertEquals(4, $o->getRecurring());
  106. $this->assertFalse($o->getNotify());
  107. }
  108. /**
  109. * @expectedException Zend_Service_DeveloperGarden_ConferenceCall_Exception
  110. */
  111. public function testConferenceScheduleObjectException()
  112. {
  113. $o = new Zend_Service_DeveloperGarden_ConferenceCall_ConferenceSchedule(
  114. 0,
  115. 1,
  116. 2,
  117. 3,
  118. 2010,
  119. 4,
  120. false
  121. );
  122. $this->assertEquals(0, $o->getMinute());
  123. $this->assertEquals(1, $o->getHour());
  124. $this->assertEquals(2, $o->getDayOfMonth());
  125. $this->assertEquals(3, $o->getMonth());
  126. $this->assertEquals(2010,$o->getYear());
  127. $this->assertEquals(4, $o->getRecurring());
  128. $this->assertFalse($o->getNotify());
  129. // should throw an exception
  130. $this->assertNull($o->setRecurring(99999));
  131. }
  132. public function testParticipantDetailObject()
  133. {
  134. $participant = new Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail(
  135. 'Marco',
  136. 'Kaiser',
  137. '+49 32 0000 0001',
  138. 'bate@php.net',
  139. true
  140. );
  141. $this->assertEquals(
  142. 'Marco',
  143. $participant->getFirstName()
  144. );
  145. $this->assertEquals(
  146. 'Kaiser',
  147. $participant->getLastName()
  148. );
  149. $this->assertEquals(
  150. '+49 32 0000 0001',
  151. $participant->getNumber()
  152. );
  153. $this->assertEquals(
  154. 'bate@php.net',
  155. $participant->getEmail()
  156. );
  157. $this->assertEquals(1, $participant->getFlags());
  158. $this->assertTrue((bool)$participant->getFlags());
  159. }
  160. /**
  161. * @expectedException Zend_Service_DeveloperGarden_Exception
  162. */
  163. public function testParticipantDetailObjectEmailException()
  164. {
  165. $participant = new Zend_Service_DeveloperGarden_ConferenceCall_ParticipantDetail(
  166. 'Marco',
  167. 'Kaiser',
  168. '+49 32 0000 0001',
  169. 'bate@php.net',
  170. true
  171. );
  172. $this->assertEquals(
  173. 'Marco',
  174. $participant->getFirstName()
  175. );
  176. $this->assertEquals(
  177. 'Kaiser',
  178. $participant->getLastName()
  179. );
  180. $this->assertEquals(
  181. '+49 32 0000 0001',
  182. $participant->getNumber()
  183. );
  184. $this->assertEquals(
  185. 'bate@php.net',
  186. $participant->getEmail()
  187. );
  188. $this->assertEquals(1, $participant->getFlags());
  189. $this->assertTrue((bool)$participant->getFlags());
  190. $this->assertNull($participant->setEmail('not-Valid'));
  191. }
  192. public function testParticipantStatus()
  193. {
  194. $status = new Zend_Service_DeveloperGarden_ConferenceCall_ParticipantStatus(
  195. 'muted',
  196. false
  197. );
  198. $this->assertEquals('muted', $status->getName());
  199. $this->assertFalse($status->getValue());
  200. }
  201. }
  202. class Zend_Service_DeveloperGarden_OfflineConferenceCall_Mock
  203. extends Zend_Service_DeveloperGarden_ConferenceCall
  204. {
  205. }
  206. if (PHPUnit_MAIN_METHOD == 'Zend_Service_DeveloperGarden_OfflineConferenceCallTest::main') {
  207. Zend_Service_DeveloperGarden_OfflineConferenceCallTest::main();
  208. }