CakeDC\Users\Test\TestCase\Controller\Traits\RegisterTraitTest::testRegisterRecaptchaNotValid PHP Method

testRegisterRecaptchaNotValid() public method

test
    public function testRegisterRecaptchaNotValid()
    {
        Configure::write('Users.reCaptcha.registration', true);
        $this->assertEquals(0, $this->table->find()->where(['username' => 'testRegistration'])->count());
        $this->_mockRequestPost();
        $this->_mockAuth();
        $this->_mockFlash();
        $this->_mockDispatchEvent();
        $this->Trait->Flash->expects($this->once())->method('error')->with('Invalid reCaptcha');
        $this->Trait->expects($this->once())->method('validateRecaptcha')->will($this->returnValue(false));
        $this->Trait->request->data = ['username' => 'testRegistration', 'password' => 'password', 'email' => '[email protected]', 'password_confirm' => 'password', 'tos' => 1];
        $this->Trait->register();
        $this->assertEquals(0, $this->table->find()->where(['username' => 'testRegistration'])->count());
        Configure::write('Users.reCaptcha.registration', false);
    }