Code Duplication    Length = 12-24 lines in 4 locations

app/Test/Case/Controller/EntriesControllerTest.php 3 locations

@@ 426-449 (lines=24) @@
423
			$this->assertTextNotContains('&<Username', $result);
424
		}
425
426
		public function testMergeNoSourceId() {
427
			$Entries = $this->generate('Entries',
428
				array(
429
					'models' => array(
430
						'Entry' => array('merge')
431
					)
432
				));
433
			$this->_loginUser(2);
434
435
			$data = array(
436
				'Entry' => array(
437
					'targetId' => 2,
438
				)
439
			);
440
441
			$Entries->Entry->expects($this->never())
442
					->method('merge');
443
			$this->setExpectedException('NotFoundException');
444
			$result = $this->testAction('/entries/merge/',
445
				array(
446
					'data' => $data,
447
					'method' => 'post'
448
				));
449
		}
450
451
		public function testMergeSourceIdNotFound() {
452
			$Entries = $this->generate('Entries',
@@ 451-474 (lines=24) @@
448
				));
449
		}
450
451
		public function testMergeSourceIdNotFound() {
452
			$Entries = $this->generate('Entries',
453
				array(
454
					'models' => array(
455
						'Entry' => array('merge')
456
					)
457
				));
458
			$this->_loginUser(2);
459
460
			$data = array(
461
				'Entry' => array(
462
					'targetId' => 2,
463
				)
464
			);
465
466
			$Entries->Entry->expects($this->never())
467
					->method('merge');
468
			$this->setExpectedException('NotFoundException');
469
			$result = $this->testAction('/entries/merge/9999',
470
				array(
471
					'data' => $data,
472
					'method' => 'post'
473
				));
474
		}
475
476
		public function testMergeShowForm() {
477
			$Entries = $this->generate('Entries',
@@ 498-521 (lines=24) @@
495
			$this->assertFalse(isset($this->headers['Location']));
496
		}
497
498
		public function testMergeIsNotAuthorized() {
499
			$Entries = $this->generate('Entries',
500
				array(
501
					'models' => array(
502
						'Entry' => array('merge')
503
					)
504
				));
505
			$this->_loginUser(3);
506
507
			$data = array(
508
				'Entry' => array(
509
					'targetId' => 2,
510
				)
511
			);
512
513
			$Entries->Entry->expects($this->never())
514
					->method('merge');
515
			$this->setExpectedException('MethodNotAllowedException');
516
			$result = $this->testAction('/entries/merge/4',
517
				array(
518
					'data' => $data,
519
					'method' => 'post'
520
				));
521
		}
522
523
		public function testMerge() {
524
			$Entries = $this->generate('Entries',

app/Test/Case/Controller/UsersControllerTest.php 1 location

@@ 483-494 (lines=12) @@
480
				'data' => ['slidetabOrder' => $data]]);
481
		}
482
483
		public function testSlidetabToggleSuccess() {
484
			$Controller = $this->generate('Users', ['models' => ['User' => ['toggle']]]);
485
			$this->_loginUser(3);
486
487
			$data = 'show_userlist';
488
			$Controller->User->expects($this->once())->method('toggle')
489
				->with($data);
490
491
			$this->_setAjax();
492
			$this->testAction('/users/slidetab_toggle', ['method' => 'POST',
493
				'data' => ['slidetabKey' => $data]]);
494
		}
495
496
		public function testSlidetabToggleFailure() {
497
			$this->generate('Users');