Krucas\LaravelUserEmailVerification\Test\DatabaseTokenRepositoryTest::testCreateShouldDeleteExistingAndInsertNewOne PHP Method

testCreateShouldDeleteExistingAndInsertNewOne() public method

    public function testCreateShouldDeleteExistingAndInsertNewOne()
    {
        $repository = $this->getRepository($mocks = $this->getMocks());
        $user = $this->getUserMock();
        $user->shouldReceive('getEmailForVerification')->andReturn('mail');
        $mocks['connection']->shouldReceive('table')->andReturn($table = $this->getQueryBuilderMock());
        $table->shouldReceive('where')->once()->with('email', 'mail')->andReturn($query = $this->getQueryBuilderMock());
        $query->shouldReceive('delete')->once();
        $table->shouldReceive('insert')->once();
        $repository->create($user);
    }