Code Duplication    Length = 22-22 lines in 2 locations

app/Test/Case/Controller/UsersControllerTest.php 2 locations

@@ 851-872 (lines=22) @@
848
			$this->assertFalse(isset($this->headers['location']));
849
		}
850
851
		public function testChangePasswordConfirmationFailed() {
852
			$this->generate('Users');
853
			$this->_loginUser(4);
854
855
			$data = [
856
				'User' => [
857
					'password_old' => 'test',
858
					'user_password' => 'test_new_foo',
859
					'password_confirm' => 'test_new_bar'
860
				]
861
			];
862
			$this->testAction('/users/changepassword/4',
863
				['data' => $data, 'method' => 'post']);
864
			$this->assertFalse($this->controller->User->validates());
865
866
			$expected = '098f6bcd4621d373cade4e832627b4f6';
867
			$this->controller->User->id = 4;
868
			$this->controller->User->contain();
869
			$result = $this->controller->User->read();
870
			$this->assertEquals($result['User']['password'], $expected);
871
			$this->assertFalse(isset($this->headers['Location']));
872
		}
873
874
		public function testChangePasswordOldPasswordNotCorrect() {
875
			$this->generate('Users');
@@ 874-895 (lines=22) @@
871
			$this->assertFalse(isset($this->headers['Location']));
872
		}
873
874
		public function testChangePasswordOldPasswordNotCorrect() {
875
			$this->generate('Users');
876
			$this->_loginUser(4);
877
878
			$data = [
879
				'User' => [
880
					'password_old' => 'test_something',
881
					'user_password' => 'test_new_foo',
882
					'password_confirm' => 'test_new_foo',
883
				]
884
			];
885
			$this->testAction('/users/changepassword/4',
886
				['data' => $data, 'method' => 'post']);
887
			$this->assertFalse($this->controller->User->validates());
888
889
			$expected = '098f6bcd4621d373cade4e832627b4f6';
890
			$this->controller->User->id = 4;
891
			$this->controller->User->contain();
892
			$result = $this->controller->User->read();
893
			$this->assertEquals($result['User']['password'], $expected);
894
			$this->assertFalse(isset($this->headers['Location']));
895
		}
896
897
		public function testChangePassword() {
898
			$this->generate('Users');