PerforceTest.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Test\Util;
  12. use Composer\Util\Perforce;
  13. use Composer\Util\ProcessExecutor;
  14. /**
  15. * @author Matt Whittom <Matt.Whittom@veteransunited.com>
  16. */
  17. class PerforceTest extends \PHPUnit_Framework_TestCase
  18. {
  19. protected $perforce;
  20. protected $processExecutor;
  21. public function setUp()
  22. {
  23. $this->processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
  24. $repoConfig = array(
  25. "depot" => "depot",
  26. "branch" => "branch",
  27. "p4user" => "user",
  28. "unique_perforce_client_name" => "TEST"
  29. );
  30. $this->perforce = new Perforce($repoConfig, "port", "path", $this->processExecutor, true);
  31. }
  32. public function testGetClientWithoutStream()
  33. {
  34. $client = $this->perforce->getClient();
  35. $hostname = gethostname();
  36. $timestamp = time();
  37. $expected = "composer_perforce_TEST_depot";
  38. $this->assertEquals($expected, $client);
  39. }
  40. public function testGetClientFromStream()
  41. {
  42. $this->setPerforceToStream();
  43. $client = $this->perforce->getClient();
  44. $expected = "composer_perforce_TEST_depot_branch";
  45. $this->assertEquals($expected, $client);
  46. }
  47. public function testGetStreamWithoutStream()
  48. {
  49. $stream = $this->perforce->getStream();
  50. $this->assertEquals("//depot", $stream);
  51. }
  52. public function testGetStreamWithStream()
  53. {
  54. $this->setPerforceToStream();
  55. $stream = $this->perforce->getStream();
  56. $this->assertEquals("//depot/branch", $stream);
  57. }
  58. public function testGetStreamWithoutLabelWithStreamWithoutLabel()
  59. {
  60. $stream = $this->perforce->getStreamWithoutLabel("//depot/branch");
  61. $this->assertEquals("//depot/branch", $stream);
  62. }
  63. public function testGetStreamWithoutLabelWithStreamWithLabel()
  64. {
  65. $stream = $this->perforce->getStreamWithoutLabel("//depot/branching@label");
  66. $this->assertEquals("//depot/branching", $stream);
  67. }
  68. public function testGetClientSpec()
  69. {
  70. $clientSpec = $this->perforce->getP4ClientSpec();
  71. $expected = "path/composer_perforce_TEST_depot.p4.spec";
  72. $this->assertEquals($expected, $clientSpec);
  73. }
  74. public function testGenerateP4Command()
  75. {
  76. $command = "do something";
  77. $p4Command = $this->perforce->generateP4Command($command);
  78. $expected = "p4 -u user -c composer_perforce_TEST_depot -p port do something";
  79. $this->assertEquals($expected, $p4Command);
  80. }
  81. public function testQueryP4UserWithUserAlreadySet()
  82. {
  83. $io = $this->getMock('Composer\IO\IOInterface');
  84. $repoConfig = array("depot" => "depot", "branch" => "branch", "p4user" => "TEST_USER");
  85. $this->perforce = new Perforce($repoConfig, "port", "path", $this->processExecutor, true, "TEST");
  86. $this->perforce->queryP4user($io);
  87. $this->assertEquals("TEST_USER", $this->perforce->getUser());
  88. }
  89. public function testQueryP4UserWithUserSetInP4VariablesWithWindowsOS()
  90. {
  91. $repoConfig = array("depot" => "depot", "branch" => "branch");
  92. $this->perforce = new Perforce($repoConfig, "port", "path", $this->processExecutor, true, "TEST");
  93. $io = $this->getMock('Composer\IO\IOInterface');
  94. $expectedCommand = "p4 set";
  95. $this->processExecutor->expects($this->at(0))
  96. ->method('execute')
  97. ->with($this->equalTo($expectedCommand))
  98. ->will(
  99. $this->returnCallback(
  100. function ($command, &$output) {
  101. $output = "P4USER=TEST_P4VARIABLE_USER\n";
  102. return true;
  103. }
  104. )
  105. );
  106. $this->perforce->queryP4user($io);
  107. $this->assertEquals("TEST_P4VARIABLE_USER", $this->perforce->getUser());
  108. }
  109. public function testQueryP4UserWithUserSetInP4VariablesNotWindowsOS()
  110. {
  111. $repoConfig = array("depot" => "depot", "branch" => "branch");
  112. $this->perforce = new Perforce($repoConfig, "port", "path", $this->processExecutor, false, "TEST");
  113. $io = $this->getMock('Composer\IO\IOInterface');
  114. $expectedCommand = 'echo $P4USER';
  115. $this->processExecutor->expects($this->at(0))
  116. ->method('execute')
  117. ->with($this->equalTo($expectedCommand))
  118. ->will(
  119. $this->returnCallback(
  120. function ($command, &$output) {
  121. $output = "TEST_P4VARIABLE_USER\n";
  122. return true;
  123. }
  124. )
  125. );
  126. $this->perforce->queryP4user($io);
  127. $this->assertEquals("TEST_P4VARIABLE_USER", $this->perforce->getUser());
  128. }
  129. public function testQueryP4UserQueriesForUser()
  130. {
  131. $repoConfig = array("depot" => "depot", "branch" => "branch");
  132. $this->perforce = new Perforce($repoConfig, "port", "path", $this->processExecutor, false, "TEST");
  133. $io = $this->getMock('Composer\IO\IOInterface');
  134. $expectedQuestion = "Enter P4 User:";
  135. $io->expects($this->at(0))
  136. ->method('ask')
  137. ->with($this->equalTo($expectedQuestion))
  138. ->will($this->returnValue("TEST_QUERY_USER"));
  139. $this->perforce->queryP4user($io);
  140. $this->assertEquals("TEST_QUERY_USER", $this->perforce->getUser());
  141. }
  142. public function testQueryP4UserStoresResponseToQueryForUserWithWindows()
  143. {
  144. $repoConfig = array("depot" => "depot", "branch" => "branch");
  145. $this->perforce = new Perforce($repoConfig, "port", "path", $this->processExecutor, true, "TEST");
  146. $io = $this->getMock('Composer\IO\IOInterface');
  147. $expectedQuestion = "Enter P4 User:";
  148. $io->expects($this->at(0))
  149. ->method('ask')
  150. ->with($this->equalTo($expectedQuestion))
  151. ->will($this->returnValue("TEST_QUERY_USER"));
  152. $expectedCommand = "p4 set P4USER=TEST_QUERY_USER";
  153. $this->processExecutor->expects($this->at(1))
  154. ->method('execute')
  155. ->with($this->equalTo($expectedCommand))
  156. ->will($this->returnValue(0));
  157. $this->perforce->queryP4user($io);
  158. }
  159. public function testQueryP4UserStoresResponseToQueryForUserWithoutWindows()
  160. {
  161. $repoConfig = array("depot" => "depot", "branch" => "branch");
  162. $this->perforce = new Perforce($repoConfig, "port", "path", $this->processExecutor, false, "TEST");
  163. $io = $this->getMock('Composer\IO\IOInterface');
  164. $expectedQuestion = "Enter P4 User:";
  165. $io->expects($this->at(0))
  166. ->method('ask')
  167. ->with($this->equalTo($expectedQuestion))
  168. ->will($this->returnValue("TEST_QUERY_USER"));
  169. $expectedCommand = "export P4USER=TEST_QUERY_USER";
  170. $this->processExecutor->expects($this->at(1))
  171. ->method('execute')
  172. ->with($this->equalTo($expectedCommand))
  173. ->will($this->returnValue(0));
  174. $this->perforce->queryP4user($io);
  175. }
  176. public function testQueryP4PasswordWithPasswordAlreadySet()
  177. {
  178. $repoConfig = array(
  179. "depot" => "depot",
  180. "branch" => "branch",
  181. "p4user" => "user",
  182. "p4password" => "TEST_PASSWORD"
  183. );
  184. $this->perforce = new Perforce($repoConfig, "port", "path", $this->processExecutor, false, "TEST");
  185. $io = $this->getMock('Composer\IO\IOInterface');
  186. $password = $this->perforce->queryP4Password($io);
  187. $this->assertEquals("TEST_PASSWORD", $password);
  188. }
  189. public function testQueryP4PasswordWithPasswordSetInP4VariablesWithWindowsOS()
  190. {
  191. $io = $this->getMock('Composer\IO\IOInterface');
  192. $expectedCommand = "p4 set";
  193. $this->processExecutor->expects($this->at(0))
  194. ->method('execute')
  195. ->with($this->equalTo($expectedCommand))
  196. ->will(
  197. $this->returnCallback(
  198. function ($command, &$output) {
  199. $output = "P4PASSWD=TEST_P4VARIABLE_PASSWORD\n";
  200. return true;
  201. }
  202. )
  203. );
  204. $password = $this->perforce->queryP4Password($io);
  205. $this->assertEquals("TEST_P4VARIABLE_PASSWORD", $password);
  206. }
  207. public function testQueryP4PasswordWithPasswordSetInP4VariablesNotWindowsOS()
  208. {
  209. $repoConfig = array("depot" => "depot", "branch" => "branch", "p4user" => "user");
  210. $this->perforce = new Perforce($repoConfig, "port", "path", $this->processExecutor, false, "TEST");
  211. $io = $this->getMock('Composer\IO\IOInterface');
  212. $expectedCommand = 'echo $P4PASSWD';
  213. $this->processExecutor->expects($this->at(0))
  214. ->method('execute')
  215. ->with($this->equalTo($expectedCommand))
  216. ->will(
  217. $this->returnCallback(
  218. function ($command, &$output) {
  219. $output = "TEST_P4VARIABLE_PASSWORD\n";
  220. return true;
  221. }
  222. )
  223. );
  224. $password = $this->perforce->queryP4Password($io);
  225. $this->assertEquals("TEST_P4VARIABLE_PASSWORD", $password);
  226. }
  227. public function testQueryP4PasswordQueriesForPassword()
  228. {
  229. $io = $this->getMock('Composer\IO\IOInterface');
  230. $expectedQuestion = "Enter password for Perforce user user: ";
  231. $io->expects($this->at(0))
  232. ->method('askAndHideAnswer')
  233. ->with($this->equalTo($expectedQuestion))
  234. ->will($this->returnValue("TEST_QUERY_PASSWORD"));
  235. $password = $this->perforce->queryP4Password($io);
  236. $this->assertEquals("TEST_QUERY_PASSWORD", $password);
  237. }
  238. public function testWriteP4ClientSpecWithoutStream()
  239. {
  240. $stream = fopen("php://memory", 'w+');
  241. $this->perforce->writeClientSpecToFile($stream);
  242. rewind($stream);
  243. $expectedArray = $this->getExpectedClientSpec(false);
  244. try {
  245. foreach ($expectedArray as $expected) {
  246. $this->assertStringStartsWith($expected, fgets($stream));
  247. }
  248. $this->assertFalse(fgets($stream));
  249. } catch (Exception $e) {
  250. fclose($stream);
  251. throw $e;
  252. }
  253. fclose($stream);
  254. }
  255. public function testWriteP4ClientSpecWithStream()
  256. {
  257. $this->setPerforceToStream();
  258. $stream = fopen("php://memory", 'w+');
  259. $this->perforce->writeClientSpecToFile($stream);
  260. rewind($stream);
  261. $expectedArray = $this->getExpectedClientSpec(true);
  262. try {
  263. foreach ($expectedArray as $expected) {
  264. $this->assertStringStartsWith($expected, fgets($stream));
  265. }
  266. $this->assertFalse(fgets($stream));
  267. } catch (Exception $e) {
  268. fclose($stream);
  269. throw $e;
  270. }
  271. fclose($stream);
  272. }
  273. public function testIsLoggedIn()
  274. {
  275. $expectedCommand = "p4 -u user -p port login -s";
  276. $this->processExecutor->expects($this->at(0))
  277. ->method('execute')
  278. ->with($this->equalTo($expectedCommand), $this->equalTo(null))
  279. ->will($this->returnValue(0));
  280. $this->perforce->isLoggedIn();
  281. }
  282. public function testConnectClient()
  283. {
  284. $expectedCommand = "p4 -u user -c composer_perforce_TEST_depot -p port client -i < path/composer_perforce_TEST_depot.p4.spec";
  285. $this->processExecutor->expects($this->at(0))
  286. ->method('execute')
  287. ->with($this->equalTo($expectedCommand), $this->equalTo(null))
  288. ->will($this->returnValue(0));
  289. $this->perforce->connectClient();
  290. }
  291. public function testGetBranchesWithStream()
  292. {
  293. $this->setPerforceToStream();
  294. $expectedCommand = "p4 -u user -c composer_perforce_TEST_depot_branch -p port streams //depot/...";
  295. $this->processExecutor->expects($this->at(0))
  296. ->method('execute')
  297. ->with($this->equalTo($expectedCommand))
  298. ->will(
  299. $this->returnCallback(
  300. function ($command, &$output) {
  301. $output = "Stream //depot/branch mainline none 'branch'\n";
  302. return true;
  303. }
  304. )
  305. );
  306. $branches = $this->perforce->getBranches();
  307. $this->assertEquals("//depot/branch", $branches['master']);
  308. }
  309. public function testGetBranchesWithoutStream()
  310. {
  311. $branches = $this->perforce->getBranches();
  312. $this->assertEquals("//depot", $branches['master']);
  313. }
  314. public function testGetTagsWithoutStream()
  315. {
  316. $expectedCommand = "p4 -u user -c composer_perforce_TEST_depot -p port labels";
  317. $this->processExecutor->expects($this->at(0))
  318. ->method('execute')
  319. ->with($this->equalTo($expectedCommand))
  320. ->will(
  321. $this->returnCallback(
  322. function ($command, &$output) {
  323. $output = "Label 0.0.1 2013/07/31 'First Label!'\nLabel 0.0.2 2013/08/01 'Second Label!'\n";
  324. return true;
  325. }
  326. )
  327. );
  328. $tags = $this->perforce->getTags();
  329. $this->assertEquals("//depot@0.0.1", $tags['0.0.1']);
  330. $this->assertEquals("//depot@0.0.2", $tags['0.0.2']);
  331. }
  332. public function testGetTagsWithStream()
  333. {
  334. $this->setPerforceToStream();
  335. $expectedCommand = "p4 -u user -c composer_perforce_TEST_depot_branch -p port labels";
  336. $this->processExecutor->expects($this->at(0))
  337. ->method('execute')
  338. ->with($this->equalTo($expectedCommand))
  339. ->will(
  340. $this->returnCallback(
  341. function ($command, &$output) {
  342. $output = "Label 0.0.1 2013/07/31 'First Label!'\nLabel 0.0.2 2013/08/01 'Second Label!'\n";
  343. return true;
  344. }
  345. )
  346. );
  347. $tags = $this->perforce->getTags();
  348. $this->assertEquals("//depot/branch@0.0.1", $tags['0.0.1']);
  349. $this->assertEquals("//depot/branch@0.0.2", $tags['0.0.2']);
  350. }
  351. public function testCheckStreamWithoutStream()
  352. {
  353. $result = $this->perforce->checkStream("depot");
  354. $this->assertFalse($result);
  355. $this->assertFalse($this->perforce->isStream());
  356. }
  357. public function testCheckStreamWithStream()
  358. {
  359. $this->processExecutor->expects($this->any())->method('execute')
  360. ->will(
  361. $this->returnCallback(
  362. function ($command, &$output) {
  363. $output = "Depot depot 2013/06/25 stream /p4/1/depots/depot/... 'Created by Me'";
  364. return true;
  365. }
  366. )
  367. );
  368. $result = $this->perforce->checkStream("depot");
  369. $this->assertTrue($result);
  370. $this->assertTrue($this->perforce->isStream());
  371. }
  372. public function testGetComposerInformationWithoutLabelWithoutStream()
  373. {
  374. $expectedCommand = "p4 -u user -c composer_perforce_TEST_depot -p port print //depot/composer.json";
  375. $this->processExecutor->expects($this->at(0))
  376. ->method('execute')
  377. ->with($this->equalTo($expectedCommand))
  378. ->will(
  379. $this->returnCallback(
  380. function ($command, &$output) {
  381. $output = PerforceTest::getComposerJson();
  382. return true;
  383. }
  384. )
  385. );
  386. $result = $this->perforce->getComposerInformation("//depot");
  387. $expected = array(
  388. "name" => "test/perforce",
  389. "description" => "Basic project for testing",
  390. "minimum-stability" => "dev",
  391. "autoload" => array("psr-0" => array())
  392. );
  393. $this->assertEquals($expected, $result);
  394. }
  395. public function testGetComposerInformationWithLabelWithoutStream()
  396. {
  397. $expectedCommand = "p4 -u user -p port files //depot/composer.json@0.0.1";
  398. $this->processExecutor->expects($this->at(0))
  399. ->method('execute')
  400. ->with($this->equalTo($expectedCommand))
  401. ->will(
  402. $this->returnCallback(
  403. function ($command, &$output) {
  404. $output = "//depot/composer.json#1 - branch change 10001 (text)";
  405. return true;
  406. }
  407. )
  408. );
  409. $expectedCommand = "p4 -u user -c composer_perforce_TEST_depot -p port print //depot/composer.json@10001";
  410. $this->processExecutor->expects($this->at(1))
  411. ->method('execute')
  412. ->with($this->equalTo($expectedCommand))
  413. ->will(
  414. $this->returnCallback(
  415. function ($command, &$output) {
  416. $output = PerforceTest::getComposerJson();
  417. return true;
  418. }
  419. )
  420. );
  421. $result = $this->perforce->getComposerInformation("//depot@0.0.1");
  422. $expected = array(
  423. "name" => "test/perforce",
  424. "description" => "Basic project for testing",
  425. "minimum-stability" => "dev",
  426. "autoload" => array("psr-0" => array())
  427. );
  428. $this->assertEquals($expected, $result);
  429. }
  430. public function testGetComposerInformationWithoutLabelWithStream()
  431. {
  432. $this->setPerforceToStream();
  433. $expectedCommand = "p4 -u user -c composer_perforce_TEST_depot_branch -p port print //depot/branch/composer.json";
  434. $this->processExecutor->expects($this->at(0))
  435. ->method('execute')
  436. ->with($this->equalTo($expectedCommand))
  437. ->will(
  438. $this->returnCallback(
  439. function ($command, &$output) {
  440. $output = PerforceTest::getComposerJson();
  441. return true;
  442. }
  443. )
  444. );
  445. $result = $this->perforce->getComposerInformation("//depot/branch");
  446. $expected = array(
  447. "name" => "test/perforce",
  448. "description" => "Basic project for testing",
  449. "minimum-stability" => "dev",
  450. "autoload" => array("psr-0" => array())
  451. );
  452. $this->assertEquals($expected, $result);
  453. }
  454. public function testGetComposerInformationWithLabelWithStream()
  455. {
  456. $this->setPerforceToStream();
  457. $expectedCommand = "p4 -u user -p port files //depot/branch/composer.json@0.0.1";
  458. $this->processExecutor->expects($this->at(0))
  459. ->method('execute')
  460. ->with($this->equalTo($expectedCommand))
  461. ->will(
  462. $this->returnCallback(
  463. function ($command, &$output) {
  464. $output = "//depot/composer.json#1 - branch change 10001 (text)";
  465. return true;
  466. }
  467. )
  468. );
  469. $expectedCommand = "p4 -u user -c composer_perforce_TEST_depot_branch -p port print //depot/branch/composer.json@10001";
  470. $this->processExecutor->expects($this->at(1))
  471. ->method('execute')
  472. ->with($this->equalTo($expectedCommand))
  473. ->will(
  474. $this->returnCallback(
  475. function ($command, &$output) {
  476. $output = PerforceTest::getComposerJson();
  477. return true;
  478. }
  479. )
  480. );
  481. $result = $this->perforce->getComposerInformation("//depot/branch@0.0.1");
  482. $expected = array(
  483. "name" => "test/perforce",
  484. "description" => "Basic project for testing",
  485. "minimum-stability" => "dev",
  486. "autoload" => array("psr-0" => array())
  487. );
  488. $this->assertEquals($expected, $result);
  489. }
  490. public function testSyncCodeBaseWithoutStream()
  491. {
  492. $expectedCommand = "p4 -u user -c composer_perforce_TEST_depot -p port sync -f @label";
  493. $this->processExecutor->expects($this->at(1))
  494. ->method('execute')
  495. ->with($this->equalTo($expectedCommand), $this->equalTo(null))
  496. ->will($this->returnValue(0));
  497. $this->perforce->syncCodeBase("label");
  498. }
  499. public function testSyncCodeBaseWithStream()
  500. {
  501. $this->setPerforceToStream();
  502. $expectedCommand = "p4 -u user -c composer_perforce_TEST_depot_branch -p port sync -f @label";
  503. $this->processExecutor->expects($this->at(1))
  504. ->method('execute')
  505. ->with($this->equalTo($expectedCommand))
  506. ->will($this->returnValue(0));
  507. $this->perforce->syncCodeBase("label");
  508. }
  509. public function testCheckServerExists()
  510. {
  511. $processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
  512. $expectedCommand = "p4 -p perforce.does.exist:port info -s";
  513. $processExecutor->expects($this->at(0))
  514. ->method('execute')
  515. ->with($this->equalTo($expectedCommand), $this->equalTo(null))
  516. ->will($this->returnValue(0));
  517. $result = $this->perforce->checkServerExists("perforce.does.exist:port", $processExecutor);
  518. $this->assertTrue($result);
  519. }
  520. public function testCheckServerExistsWithFailure()
  521. {
  522. $processExecutor = $this->getMock('Composer\Util\ProcessExecutor');
  523. $expectedCommand = "p4 -p perforce.does.not.exist:port info -s";
  524. $processExecutor->expects($this->at(0))
  525. ->method('execute')
  526. ->with($this->equalTo($expectedCommand), $this->equalTo(null))
  527. ->will($this->returnValue("Perforce client error:"));
  528. $result = $this->perforce->checkServerExists("perforce.does.not.exist:port", $processExecutor);
  529. $this->assertTrue($result);
  530. }
  531. public static function getComposerJson()
  532. {
  533. $composer_json = array(
  534. '{',
  535. '"name": "test/perforce",',
  536. '"description": "Basic project for testing",',
  537. '"minimum-stability": "dev",',
  538. '"autoload": {',
  539. '"psr-0" : {',
  540. '}',
  541. '}',
  542. '}'
  543. );
  544. return implode($composer_json);
  545. }
  546. private function getExpectedClientSpec($withStream)
  547. {
  548. $expectedArray = array(
  549. "Client: composer_perforce_TEST_depot",
  550. "\n",
  551. "Update:",
  552. "\n",
  553. "Access:",
  554. "Owner: user",
  555. "\n",
  556. "Description:",
  557. " Created by user from composer.",
  558. "\n",
  559. "Root: path",
  560. "\n",
  561. "Options: noallwrite noclobber nocompress unlocked modtime rmdir",
  562. "\n",
  563. "SubmitOptions: revertunchanged",
  564. "\n",
  565. "LineEnd: local",
  566. "\n"
  567. );
  568. if ($withStream) {
  569. $expectedArray[] = "Stream:";
  570. $expectedArray[] = " //depot/branch";
  571. } else {
  572. $expectedArray[] = "View: //depot/... //composer_perforce_TEST_depot/depot/...";
  573. }
  574. return $expectedArray;
  575. }
  576. private function setPerforceToStream()
  577. {
  578. $this->perforce->setStream("//depot/branch");
  579. }
  580. }