Code Duplication    Length = 13-14 lines in 5 locations

build/integration/features/bootstrap/Provisioning.php 5 locations

@@ 138-151 (lines=14) @@
135
	 * @param string $user
136
	 * @param string $group
137
	 */
138
	public function checkThatUserBelongsToGroup($user, $group) {
139
		$fullUrl = $this->baseUrl . "v2.php/cloud/users/$user/groups";
140
		$client = new Client();
141
		$options = [];
142
		if ($this->currentUser === 'admin') {
143
			$options['auth'] = $this->adminUser;
144
		}
145
146
		$this->response = $client->get($fullUrl, $options);
147
		$respondedArray = $this->getArrayOfGroupsResponded($this->response);
148
		sort($respondedArray);
149
		PHPUnit_Framework_Assert::assertContains($group, $respondedArray);
150
		PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
151
	}
152
153
	public function userBelongsToGroup($user, $group) {
154
		$fullUrl = $this->baseUrl . "v2.php/cloud/users/$user/groups";
@@ 364-377 (lines=14) @@
361
	 * @param string $user
362
	 * @param string $group
363
	 */
364
	public function userIsSubadminOfGroup($user, $group) {
365
		$fullUrl = $this->baseUrl . "v2.php/cloud/groups/$group/subadmins";
366
		$client = new Client();
367
		$options = [];
368
		if ($this->currentUser === 'admin') {
369
			$options['auth'] = $this->adminUser;
370
		}
371
372
		$this->response = $client->get($fullUrl, $options);
373
		$respondedArray = $this->getArrayOfSubadminsResponded($this->response);
374
		sort($respondedArray);
375
		PHPUnit_Framework_Assert::assertContains($user, $respondedArray);
376
		PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
377
	}
378
379
	/**
380
	 * @Given /^Assure user "([^"]*)" is subadmin of group "([^"]*)"$/
@@ 403-416 (lines=14) @@
400
	 * @param string $user
401
	 * @param string $group
402
	 */
403
	public function userIsNotSubadminOfGroup($user, $group) {
404
		$fullUrl = $this->baseUrl . "v2.php/cloud/groups/$group/subadmins";
405
		$client = new Client();
406
		$options = [];
407
		if ($this->currentUser === 'admin') {
408
			$options['auth'] = $this->adminUser;
409
		}
410
411
		$this->response = $client->get($fullUrl, $options);
412
		$respondedArray = $this->getArrayOfSubadminsResponded($this->response);
413
		sort($respondedArray);
414
		PHPUnit_Framework_Assert::assertNotContains($user, $respondedArray);
415
		PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
416
	}
417
418
	/**
419
	 * @Then /^users returned are$/
@@ 531-543 (lines=13) @@
528
	 * @Given /^app "([^"]*)" is disabled$/
529
	 * @param string $app
530
	 */
531
	public function appIsDisabled($app) {
532
		$fullUrl = $this->baseUrl . "v2.php/cloud/apps?filter=disabled";
533
		$client = new Client();
534
		$options = [];
535
		if ($this->currentUser === 'admin') {
536
			$options['auth'] = $this->adminUser;
537
		}
538
539
		$this->response = $client->get($fullUrl, $options);
540
		$respondedArray = $this->getArrayOfAppsResponded($this->response);
541
		PHPUnit_Framework_Assert::assertContains($app, $respondedArray);
542
		PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
543
	}
544
545
	/**
546
	 * @Given /^app "([^"]*)" is enabled$/
@@ 549-561 (lines=13) @@
546
	 * @Given /^app "([^"]*)" is enabled$/
547
	 * @param string $app
548
	 */
549
	public function appIsEnabled($app) {
550
		$fullUrl = $this->baseUrl . "v2.php/cloud/apps?filter=enabled";
551
		$client = new Client();
552
		$options = [];
553
		if ($this->currentUser === 'admin') {
554
			$options['auth'] = $this->adminUser;
555
		}
556
557
		$this->response = $client->get($fullUrl, $options);
558
		$respondedArray = $this->getArrayOfAppsResponded($this->response);
559
		PHPUnit_Framework_Assert::assertContains($app, $respondedArray);
560
		PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode());
561
	}
562
563
	/**
564
	 * @Then /^user "([^"]*)" is disabled$/