Code Duplication    Length = 29-31 lines in 2 locations

apps/user_ldap/tests/user/user.php 2 locations

@@ 817-847 (lines=31) @@
814
		$this->assertSame($path, false);
815
	}
816
817
	public function testGetHomePathConfiguredNotAvailableAllowed() {
818
		list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) =
819
			$this->getTestInstances();
820
821
		list($access, $connection) =
822
			$this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc);
823
824
		$connection->expects($this->any())
825
			->method('__get')
826
			->with($this->equalTo('homeFolderNamingRule'))
827
			->will($this->returnValue('attr:foobar'));
828
829
		$access->expects($this->once())
830
			->method('readAttribute')
831
			->will($this->returnValue(false));
832
833
		// asks for "enforce_home_folder_naming_rule"
834
		$config->expects($this->once())
835
			->method('getAppValue')
836
			->will($this->returnValue(false));
837
838
		$uid = 'alice';
839
		$dn  = 'uid=alice,dc=foo,dc=bar';
840
841
		$user = new User(
842
			$uid, $dn, $access, $config, $filesys, $image, $log, $avaMgr);
843
844
		$path = $user->getHomePath();
845
846
		$this->assertSame($path, false);
847
	}
848
849
	/**
850
	 * @expectedException \Exception
@@ 852-880 (lines=29) @@
849
	/**
850
	 * @expectedException \Exception
851
	 */
852
	public function testGetHomePathConfiguredNotAvailableNotAllowed() {
853
		list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) =
854
			$this->getTestInstances();
855
856
		list($access, $connection) =
857
			$this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc);
858
859
		$connection->expects($this->any())
860
			->method('__get')
861
			->with($this->equalTo('homeFolderNamingRule'))
862
			->will($this->returnValue('attr:foobar'));
863
864
		$access->expects($this->once())
865
			->method('readAttribute')
866
			->will($this->returnValue(false));
867
868
		// asks for "enforce_home_folder_naming_rule"
869
		$config->expects($this->once())
870
			->method('getAppValue')
871
			->will($this->returnValue(true));
872
873
		$uid = 'alice';
874
		$dn  = 'uid=alice,dc=foo,dc=bar';
875
876
		$user = new User(
877
			$uid, $dn, $access, $config, $filesys, $image, $log, $avaMgr);
878
879
		$user->getHomePath();
880
	}
881
882
	public function displayNameProvider() {
883
		return [