OfflineTest.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  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_Ldap
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /**
  22. * Zend_Ldap_TestCase
  23. */
  24. require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'TestCase.php';
  25. /**
  26. * Zend_Ldap_Node
  27. */
  28. require_once 'Zend/Ldap/Node.php';
  29. /**
  30. * @category Zend
  31. * @package Zend_Ldap
  32. * @subpackage UnitTests
  33. * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  34. * @license http://framework.zend.com/license/new-bsd New BSD License
  35. */
  36. class Zend_Ldap_Node_OfflineTest extends Zend_Ldap_TestCase
  37. {
  38. protected function _assertLocalDateTimeString($timestamp, $value)
  39. {
  40. $this->assertEquals(date('YmdHisO', $timestamp), $value);
  41. }
  42. protected function _assertUtcDateTimeString($localTimestamp, $value)
  43. {
  44. $currentOffset = date('Z');
  45. $utcTimestamp = $localTimestamp - $currentOffset;
  46. $this->assertEquals(date('YmdHis', $utcTimestamp) . 'Z', $value);
  47. }
  48. public function testCreateFromArrayStringDn()
  49. {
  50. $data=$this->_createTestArrayData();
  51. $node=Zend_Ldap_Node::fromArray($data);
  52. $this->assertType('Zend_Ldap_Node', $node);
  53. $this->assertFalse($node->isAttached());
  54. $this->assertFalse($node->willBeDeleted());
  55. $this->assertFalse($node->willBeMoved());
  56. $this->assertTrue($node->isNew());
  57. }
  58. public function testCreateFromArrayObjectDn()
  59. {
  60. $data=$this->_createTestArrayData();
  61. $data['dn']=Zend_Ldap_Dn::fromString($data['dn']);
  62. $node=Zend_Ldap_Node::fromArray($data);
  63. $this->assertType('Zend_Ldap_Node', $node);
  64. $this->assertFalse($node->isAttached());
  65. }
  66. /**
  67. * @expectedException Zend_Ldap_Exception
  68. */
  69. public function testCreateFromArrayMissingDn()
  70. {
  71. $data=$this->_createTestArrayData();
  72. unset($data['dn']);
  73. $node=Zend_Ldap_Node::fromArray($data);
  74. }
  75. /**
  76. * @expectedException Zend_Ldap_Exception
  77. */
  78. public function testCreateFromArrayIllegalDn()
  79. {
  80. $data=$this->_createTestArrayData();
  81. $data['dn']=5;
  82. $node=Zend_Ldap_Node::fromArray($data);
  83. }
  84. /**
  85. * @expectedException Zend_Ldap_Exception
  86. */
  87. public function testCreateFromArrayMalformedDn()
  88. {
  89. $data=$this->_createTestArrayData();
  90. $data['dn']='name1,cn=name2,dc=example,dc=org';
  91. $node=Zend_Ldap_Node::fromArray($data);
  92. }
  93. public function testCreateFromArrayAndEnsureRdnValues()
  94. {
  95. $data=$this->_createTestArrayData();
  96. $data['dn']=Zend_Ldap_Dn::fromString($data['dn']);
  97. $node=Zend_Ldap_Node::fromArray($data);
  98. $this->assertType('Zend_Ldap_Node', $node);
  99. $this->assertFalse($node->isAttached());
  100. unset($data['dn']);
  101. $this->assertEquals($data, $node->getData());
  102. }
  103. public function testGetDnString()
  104. {
  105. $data=$this->_createTestArrayData();
  106. $node=Zend_Ldap_Node::fromArray($data);
  107. $this->assertEquals($data['dn'], $node->getDnString());
  108. }
  109. public function testGetDnArray()
  110. {
  111. $data=$this->_createTestArrayData();
  112. $node=Zend_Ldap_Node::fromArray($data);
  113. $exA=Zend_Ldap_Dn::explodeDn($data['dn']);
  114. $this->assertEquals($exA, $node->getDnArray());
  115. }
  116. public function testGetDnObject()
  117. {
  118. $data=$this->_createTestArrayData();
  119. $node=Zend_Ldap_Node::fromArray($data);
  120. $compareDn=Zend_Ldap_Dn::fromString('cn=name,dc=example,dc=org');
  121. $this->assertEquals($compareDn, $node->getDn());
  122. $this->assertNotSame($node->getDn(), $node->getDn());
  123. }
  124. public function testGetRdnString()
  125. {
  126. $node=$this->_createTestNode();
  127. $this->assertEquals('cn=name', $node->getRdnString());
  128. }
  129. public function testGetRdnArray()
  130. {
  131. $node=$this->_createTestNode();
  132. $this->assertEquals(array('cn' => 'name'), $node->getRdnArray());
  133. }
  134. public function testSerialize()
  135. {
  136. $node=$this->_createTestNode();
  137. $sdata=serialize($node);
  138. $newObject=unserialize($sdata);
  139. $this->assertEquals($node, $newObject);
  140. }
  141. public function testToString()
  142. {
  143. $node=$this->_createTestNode();
  144. $this->assertEquals('cn=name,dc=example,dc=org', $node->toString());
  145. $this->assertEquals('cn=name,dc=example,dc=org', (string)$node);
  146. }
  147. public function testToArray()
  148. {
  149. $node=$this->_createTestNode();
  150. $this->assertEquals(array(
  151. 'dn' => 'cn=name,dc=example,dc=org',
  152. 'cn' => array('name'),
  153. 'host' => array('a', 'b', 'c'),
  154. 'empty' => array(),
  155. 'boolean' => array(true, false),
  156. 'objectclass' => array('account', 'top'),
  157. ), $node->toArray());
  158. }
  159. public function testToJson()
  160. {
  161. $node=$this->_createTestNode();
  162. $this->assertEquals('{"dn":"cn=name,dc=example,dc=org",' .
  163. '"boolean":[true,false],' .
  164. '"cn":["name"],' .
  165. '"empty":[],' .
  166. '"host":["a","b","c"],' .
  167. '"objectclass":["account","top"]}', $node->toJson());
  168. }
  169. public function testGetData()
  170. {
  171. $data=$this->_createTestArrayData();
  172. $node=Zend_Ldap_Node::fromArray($data);
  173. ksort($data, SORT_STRING);
  174. unset($data['dn']);
  175. $this->assertEquals($data, $node->getData());
  176. }
  177. public function testGetObjectClass()
  178. {
  179. $node=$this->_createTestNode();
  180. $this->assertEquals(array('account', 'top'), $node->getObjectClass());
  181. }
  182. public function testModifyObjectClass()
  183. {
  184. $node=$this->_createTestNode();
  185. $this->assertEquals(array('account', 'top'), $node->getObjectClass());
  186. $node->setObjectClass('domain');
  187. $this->assertEquals(array('domain'), $node->getObjectClass());
  188. $node->setObjectClass(array('account', 'top'));
  189. $this->assertEquals(array('account', 'top'), $node->getObjectClass());
  190. $node->appendObjectClass('domain');
  191. $this->assertEquals(array('account', 'top', 'domain'), $node->getObjectClass());
  192. $node->setObjectClass('domain');
  193. $node->appendObjectClass(array('account', 'top'));
  194. $this->assertEquals(array('domain', 'account', 'top'), $node->getObjectClass());
  195. }
  196. public function testGetAttributes()
  197. {
  198. $node=$this->_createTestNode();
  199. $expected=array(
  200. 'boolean' => array(true, false),
  201. 'cn' => array('name'),
  202. 'empty' => array(),
  203. 'host' => array('a', 'b', 'c'),
  204. 'objectclass' => array('account', 'top'),
  205. );
  206. $this->assertEquals($expected, $node->getAttributes());
  207. $this->assertFalse($node->willBeDeleted());
  208. $this->assertFalse($node->willBeMoved());
  209. $this->assertFalse($node->isNew());
  210. $node->delete();
  211. $this->assertTrue($node->willBeDeleted());
  212. }
  213. public function testAppendToAttributeFirstTime()
  214. {
  215. $node=$this->_createTestNode();
  216. $node->appendToAttribute('host', 'newHost');
  217. $ts=mktime(12, 30, 30, 6, 25, 2008);
  218. $node->appendToDateTimeAttribute('objectClass', $ts);
  219. $this->assertEquals('newHost', $node->host[3]);
  220. $this->assertEquals($ts, $node->getDateTimeAttribute('objectClass', 2));
  221. }
  222. public function testExistsAttribute()
  223. {
  224. $node=$this->_createTestNode();
  225. $this->assertFalse($node->existsAttribute('nonExistant'));
  226. $this->assertFalse($node->existsAttribute('empty', false));
  227. $this->assertTrue($node->existsAttribute('empty', true));
  228. $node->newEmpty=null;
  229. $this->assertFalse($node->existsAttribute('newEmpty', false));
  230. $this->assertTrue($node->existsAttribute('newEmpty', true));
  231. $node->empty='string';
  232. $this->assertTrue($node->existsAttribute('empty', false));
  233. $this->assertTrue($node->existsAttribute('empty', true));
  234. $node->deleteAttribute('empty');
  235. $this->assertFalse($node->existsAttribute('empty', false));
  236. $this->assertTrue($node->existsAttribute('empty', true));
  237. }
  238. public function testGetSetAndDeleteMethods()
  239. {
  240. $node=$this->_createTestNode();
  241. $node->setAttribute('key', 'value1');
  242. $this->assertEquals('value1', $node->getAttribute('key', 0));
  243. $node->appendToAttribute('key', 'value2');
  244. $this->assertEquals('value1', $node->getAttribute('key', 0));
  245. $this->assertEquals('value2', $node->getAttribute('key', 1));
  246. $this->assertTrue($node->existsAttribute('key', true));
  247. $this->assertTrue($node->existsAttribute('key', false));
  248. $node->deleteAttribute('key');
  249. $this->assertEquals(0, count($node->getAttribute('key')));
  250. $this->assertTrue($node->existsAttribute('key', true));
  251. $this->assertFalse($node->existsAttribute('key', false));
  252. $ts=mktime(12, 30, 30, 6, 25, 2008);
  253. $node->setDateTimeAttribute('key', $ts, false);
  254. $this->_assertLocalDateTimeString($ts, $node->getAttribute('key', 0));
  255. $this->assertEquals($ts, $node->getDateTimeAttribute('key', 0));
  256. $node->appendToDateTimeAttribute('key', $ts, true);
  257. $this->_assertLocalDateTimeString($ts, $node->getAttribute('key', 0));
  258. $this->assertEquals($ts, $node->getDateTimeAttribute('key', 0));
  259. $this->_assertUtcDateTimeString($ts, $node->getAttribute('key', 1));
  260. $this->assertEquals($ts, $node->getDateTimeAttribute('key', 1));
  261. $this->assertTrue($node->existsAttribute('key', true));
  262. $this->assertTrue($node->existsAttribute('key', false));
  263. $node->deleteAttribute('key');
  264. $this->assertEquals(0, count($node->getAttribute('key')));
  265. $this->assertTrue($node->existsAttribute('key', true));
  266. $this->assertFalse($node->existsAttribute('key', false));
  267. $node->setPasswordAttribute('pa$$w0rd', Zend_Ldap_Attribute::PASSWORD_HASH_MD5);
  268. $this->assertEquals('{MD5}bJuLJ96h3bhF+WqiVnxnVA==', $node->getAttribute('userPassword', 0));
  269. $this->assertTrue($node->existsAttribute('userPassword', true));
  270. $this->assertTrue($node->existsAttribute('userPassword', false));
  271. $node->deleteAttribute('userPassword');
  272. $this->assertEquals(0, count($node->getAttribute('userPassword')));
  273. $this->assertTrue($node->existsAttribute('userPassword', true));
  274. $this->assertFalse($node->existsAttribute('userPassword', false));
  275. }
  276. public function testOverloading()
  277. {
  278. $node=$this->_createTestNode();
  279. $node->key='value1';
  280. $this->assertEquals('value1', $node->key[0]);
  281. $this->assertTrue(isset($node->key));
  282. unset($node->key);
  283. $this->assertEquals(0, count($node->key));
  284. $this->assertFalse(isset($node->key));
  285. }
  286. /**
  287. * @expectedException Zend_Ldap_Exception
  288. */
  289. public function testIllegalAttributeAccessRdnAttributeSet()
  290. {
  291. $node=$this->_createTestNode();
  292. $node->cn='test';
  293. }
  294. /**
  295. * @expectedException Zend_Ldap_Exception
  296. */
  297. public function testIllegalAttributeAccessDnSet()
  298. {
  299. $node=$this->_createTestNode();
  300. $node->dn='test';
  301. }
  302. public function testAttributeAccessDnGet()
  303. {
  304. $node=$this->_createTestNode();
  305. $this->assertType('string', $node->dn);
  306. $this->assertEquals($node->getDn()->toString(), $node->dn);
  307. }
  308. public function testArrayAccess()
  309. {
  310. $node=$this->_createTestNode();
  311. $node['key']='value1';
  312. $this->assertEquals('value1', $node['key'][0]);
  313. $this->assertTrue(isset($node['key']));
  314. unset($node['key']);
  315. $this->assertEquals(0, count($node['key']));
  316. $this->assertFalse(isset($node['key']));
  317. }
  318. public function testCreateEmptyNode()
  319. {
  320. $dn='cn=name,dc=example,dc=org';
  321. $objectClass=array('account', 'test', 'inetOrgPerson');
  322. $node=Zend_Ldap_Node::create($dn, $objectClass);
  323. $this->assertEquals($dn, $node->getDnString());
  324. $this->assertEquals('cn=name', $node->getRdnString());
  325. $this->assertEquals('name', $node->cn[0]);
  326. $this->assertEquals($objectClass, $node->objectClass);
  327. $this->assertFalse($node->willBeDeleted());
  328. $this->assertFalse($node->willBeMoved());
  329. $this->assertTrue($node->isNew());
  330. $node->delete();
  331. $this->assertTrue($node->willBeDeleted());
  332. }
  333. public function testGetChangedData()
  334. {
  335. $node=$this->_createTestNode();
  336. $node->host=array('d');
  337. $node->empty='not Empty';
  338. unset($node->objectClass);
  339. $changedData=$node->getChangedData();
  340. $this->assertEquals(array('d'), $changedData['host']);
  341. $this->assertEquals(array('not Empty'), $changedData['empty']);
  342. $this->assertEquals(array(), $changedData['objectclass']);
  343. }
  344. public function testDeleteUnusedAttribute()
  345. {
  346. $node=$this->_createTestNode();
  347. $node->deleteAttribute('nonexistant');
  348. $changedData=$node->getChangedData();
  349. $this->assertArrayNotHasKey('nonexistant', $changedData);
  350. }
  351. public function testRenameNodeString()
  352. {
  353. $data=$this->_createTestArrayData();
  354. $node=Zend_Ldap_Node::fromArray($data);
  355. $newDnString='cn=test+ou=Lab+uid=tester,cn=name,dc=example,dc=org';
  356. $node->setDn($newDnString);
  357. $this->assertEquals($data['dn'], $node->getCurrentDn()->toString());
  358. $this->assertEquals($newDnString, $node->getDn()->toString());
  359. $this->assertEquals(array('test'), $node->cn);
  360. $this->assertEquals(array('tester'), $node->uid);
  361. $this->assertEquals(array('Lab'), $node->ou);
  362. $this->assertFalse($node->willBeDeleted());
  363. $this->assertFalse($node->willBeMoved());
  364. $this->assertTrue($node->isNew());
  365. }
  366. public function testRenameNodeArray()
  367. {
  368. $data=$this->_createTestArrayData();
  369. $node=Zend_Ldap_Node::fromArray($data);
  370. $newDnArray=array(
  371. array('uid' => 'tester'),
  372. array('dc' => 'example'),
  373. array('dc' => 'org'));
  374. $node->setDn($newDnArray);
  375. $this->assertEquals($data['dn'], $node->getCurrentDn()->toString());
  376. $this->assertEquals($newDnArray, $node->getDn()->toArray());
  377. $this->assertEquals(array('name'), $node->cn);
  378. }
  379. public function testRenameNodeDnObject()
  380. {
  381. $data=$this->_createTestArrayData();
  382. $node=Zend_Ldap_Node::fromArray($data);
  383. $newDn=Zend_Ldap_Dn::fromString('cn=test+ou=Lab+uid=tester,cn=name,dc=example,dc=org');
  384. $node->setDn($newDn);
  385. $this->assertEquals($data['dn'], $node->getCurrentDn()->toString());
  386. $this->assertEquals($newDn, $node->getDn());
  387. $this->assertEquals(array('test'), $node->cn);
  388. $this->assertEquals(array('tester'), $node->uid);
  389. $this->assertEquals(array('Lab'), $node->ou);
  390. }
  391. public function testRenameNodeFromDataSource()
  392. {
  393. $node=$this->_createTestNode();
  394. $newDnString='cn=test+ou=Lab+uid=tester,cn=name,dc=example,dc=org';
  395. $node->rename($newDnString);
  396. $this->assertFalse($node->willBeDeleted());
  397. $this->assertTrue($node->willBeMoved());
  398. $this->assertFalse($node->isNew());
  399. }
  400. public function testDnObjectCloning()
  401. {
  402. $node1=$this->_createTestNode();
  403. $dn1=Zend_Ldap_Dn::fromString('cn=name2,dc=example,dc=org');
  404. $node1->setDn($dn1);
  405. $dn1->prepend(array('cn' => 'name'));
  406. $this->assertNotEquals($dn1->toString(), $node1->getDn()->toString());
  407. $dn2=Zend_Ldap_Dn::fromString('cn=name2,dc=example,dc=org');
  408. $node2=Zend_Ldap_Node::create($dn2);
  409. $dn2->prepend(array('cn' => 'name'));
  410. $this->assertNotEquals($dn2->toString(), $node2->getDn()->toString());
  411. $dn3=Zend_Ldap_Dn::fromString('cn=name2,dc=example,dc=org');
  412. $node3=Zend_Ldap_Node::fromArray(array(
  413. 'dn' => $dn3,
  414. 'ou' => 'Test'), false);
  415. $dn3->prepend(array('cn' => 'name'));
  416. $this->assertNotEquals($dn3->toString(), $node3->getDn()->toString());
  417. }
  418. public function testGetChanges()
  419. {
  420. $node=$this->_createTestNode();
  421. $node->host=array('d');
  422. $node->empty='not Empty';
  423. unset($node->boolean);
  424. $changes=$node->getChanges();
  425. $this->assertEquals(array(
  426. 'add' => array(
  427. 'empty' => array('not Empty')
  428. ),
  429. 'delete' => array(
  430. 'boolean' => array()
  431. ),
  432. 'replace' => array(
  433. 'host' => array('d')
  434. )
  435. ), $changes);
  436. $node=Zend_Ldap_Node::create('uid=test,dc=example,dc=org', array('account'));
  437. $node->host='host';
  438. unset($node->cn);
  439. unset($node['sn']);
  440. $node['givenName']='givenName';
  441. $node->appendToAttribute('objectClass', 'domain');
  442. $this->assertEquals(array(
  443. 'uid' => array('test'),
  444. 'objectclass' => array('account', 'domain'),
  445. 'host' => array('host'),
  446. 'givenname' => array('givenName')
  447. ), $node->getChangedData());
  448. $this->assertEquals(array(
  449. 'add' => array(
  450. 'uid' => array('test'),
  451. 'objectclass' => array('account', 'domain'),
  452. 'host' => array('host'),
  453. 'givenname' => array('givenName'),
  454. ),
  455. 'delete' => array(),
  456. 'replace' => array()
  457. ), $node->getChanges());
  458. }
  459. public function testHasValue()
  460. {
  461. $node=$this->_createTestNode();
  462. $this->assertTrue($node->attributeHasValue('cn', 'name'));
  463. $this->assertFalse($node->attributeHasValue('cn', 'noname'));
  464. $this->assertTrue($node->attributeHasValue('boolean', true));
  465. $this->assertTrue($node->attributeHasValue('boolean', false));
  466. $this->assertTrue($node->attributeHasValue('host', array('a', 'b')));
  467. $this->assertTrue($node->attributeHasValue('host', array('a', 'b', 'c')));
  468. $this->assertFalse($node->attributeHasValue('host', array('a', 'b', 'c', 'd')));
  469. $this->assertTrue($node->attributeHasValue('boolean', array(true, false)));
  470. }
  471. public function testRemoveDuplicates()
  472. {
  473. $node=$this->_createTestNode();
  474. $node->strings1= array('value1', 'value2', 'value2', 'value3');
  475. $node->strings2= array('value1', 'value2', 'value3', 'value4');
  476. $node->boolean1= array(true, true, true, true);
  477. $node->boolean2= array(true, false, true, false);
  478. $expected=array(
  479. 'cn' => array('name'),
  480. 'host' => array('a', 'b', 'c'),
  481. 'empty' => array(),
  482. 'boolean' => array('TRUE', 'FALSE'),
  483. 'objectclass' => array('account', 'top'),
  484. 'strings1' => array('value1', 'value2', 'value3'),
  485. 'strings2' => array('value1', 'value2', 'value3', 'value4'),
  486. 'boolean1' => array('TRUE'),
  487. 'boolean2' => array('TRUE', 'FALSE'),
  488. );
  489. $node->removeDuplicatesFromAttribute('strings1');
  490. $node->removeDuplicatesFromAttribute('strings2');
  491. $node->removeDuplicatesFromAttribute('boolean1');
  492. $node->removeDuplicatesFromAttribute('boolean2');
  493. $this->assertEquals($expected, $node->getData(false));
  494. }
  495. public function testRemoveFromAttributeSimple()
  496. {
  497. $node=$this->_createTestNode();
  498. $node->test=array('value1', 'value2', 'value3', 'value3');
  499. $node->removeFromAttribute('test', 'value2');
  500. $this->assertEquals(array('value1', 'value3', 'value3'), $node->test);
  501. }
  502. public function testRemoveFromAttributeArray()
  503. {
  504. $node=$this->_createTestNode();
  505. $node->test=array('value1', 'value2', 'value3', 'value3');
  506. $node->removeFromAttribute('test', array('value1', 'value2'));
  507. $this->assertEquals(array('value3', 'value3'), $node->test);
  508. }
  509. public function testRemoveFromAttributeMultipleSimple()
  510. {
  511. $node=$this->_createTestNode();
  512. $node->test=array('value1', 'value2', 'value3', 'value3');
  513. $node->removeFromAttribute('test', 'value3');
  514. $this->assertEquals(array('value1', 'value2'), $node->test);
  515. }
  516. public function testRemoveFromAttributeMultipleArray()
  517. {
  518. $node=$this->_createTestNode();
  519. $node->test=array('value1', 'value2', 'value3', 'value3');
  520. $node->removeFromAttribute('test', array('value1', 'value3'));
  521. $this->assertEquals(array('value2'), $node->test);
  522. }
  523. }