Code Duplication    Length = 35-35 lines in 2 locations

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

@@ 566-600 (lines=35) @@
563
		$user->updateAvatar();
564
	}
565
566
	public function testUpdateBeforeFirstLogin() {
567
		list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) =
568
			$this->getTestInstances();
569
570
		list($access, $connection) =
571
			$this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc);
572
573
		$config->expects($this->at(0))
574
			->method('getUserValue')
575
			->with($this->equalTo('alice'), $this->equalTo('user_ldap'),
576
				$this->equalTo(User::USER_PREFKEY_FIRSTLOGIN),
577
				$this->equalTo(0))
578
			->will($this->returnValue(0));
579
580
		$config->expects($this->at(1))
581
			->method('getUserValue')
582
			->with($this->equalTo('alice'), $this->equalTo('user_ldap'),
583
				$this->equalTo(User::USER_PREFKEY_LASTREFRESH),
584
				$this->equalTo(0))
585
			->will($this->returnValue(0));
586
587
		$config->expects($this->exactly(2))
588
			->method('getUserValue');
589
590
		$config->expects($this->never())
591
			->method('setUserValue');
592
593
		$uid = 'alice';
594
		$dn  = 'uid=alice,dc=foo,dc=bar';
595
596
		$user = new User(
597
			$uid, $dn, $access, $config, $filesys, $image, $log, $avaMgr);
598
599
		$user->update();
600
	}
601
602
	public function testUpdateAfterFirstLogin() {
603
		list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) =
@@ 642-676 (lines=35) @@
639
		$user->update();
640
	}
641
642
	public function testUpdateNoRefresh() {
643
		list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) =
644
			$this->getTestInstances();
645
646
		list($access, $connection) =
647
			$this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc);
648
649
		$config->expects($this->at(0))
650
			->method('getUserValue')
651
			->with($this->equalTo('alice'), $this->equalTo('user_ldap'),
652
				$this->equalTo(User::USER_PREFKEY_FIRSTLOGIN),
653
				$this->equalTo(0))
654
			->will($this->returnValue(1));
655
656
		$config->expects($this->at(1))
657
			->method('getUserValue')
658
			->with($this->equalTo('alice'), $this->equalTo('user_ldap'),
659
				$this->equalTo(User::USER_PREFKEY_LASTREFRESH),
660
				$this->equalTo(0))
661
			->will($this->returnValue(time()));
662
663
		$config->expects($this->exactly(2))
664
			->method('getUserValue');
665
666
		$config->expects($this->never())
667
			->method('setUserValue');
668
669
		$uid = 'alice';
670
		$dn  = 'uid=alice,dc=foo,dc=bar';
671
672
		$user = new User(
673
			$uid, $dn, $access, $config, $filesys, $image, $log, $avaMgr);
674
675
		$user->update();
676
	}
677
678
	public function testMarkLogin() {
679
		list($access, $config, $filesys, $image, $log, $avaMgr) =