public function testSocialEmailPostValidateTrue() { $session = $this->getMockBuilder('Cake\\Network\\Session')->setMethods(['check', 'delete'])->getMock(); $session->expects($this->any())->method('check')->with('Users.social')->will($this->returnValue(true)); $session->expects($this->once())->method('delete')->with('Flash.auth'); $this->controller->Trait->request = $this->getMockBuilder('Cake\\Network\\Request')->setMethods(['session', 'is'])->getMock(); $this->controller->Trait->request->expects($this->any())->method('session')->will($this->returnValue($session)); $this->controller->Trait->request->expects($this->once())->method('is')->with('post')->will($this->returnValue(true)); $this->controller->Trait->expects($this->once())->method('_validateRegisterPost')->will($this->returnValue(true)); $this->controller->Trait->Auth = $this->getMockBuilder('Cake\\Controller\\Component\\AuthComponent')->setMethods(['identify'])->disableOriginalConstructor()->getMock(); $this->controller->Trait->Auth->expects($this->once())->method('identify'); $this->controller->Trait->expects($this->once())->method('_afterIdentifyUser'); $this->controller->Trait->socialEmail(); }