You are here

public function AuthmapTest::testDeleteWithProvider in External Authentication 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/AuthmapTest.php \Drupal\Tests\externalauth\Unit\AuthmapTest::testDeleteWithProvider()

Test delete() method, when passing in $provider.

@covers ::delete @covers ::__construct

File

tests/src/Unit/AuthmapTest.php, line 250

Class

AuthmapTest
Authmap unit tests.

Namespace

Drupal\Tests\externalauth\Unit

Code

public function testDeleteWithProvider() {

  // Create a Mock Delete object and set expectations.
  $this->delete = $this
    ->getMockBuilder('Drupal\\Core\\Database\\Query\\Delete')
    ->disableOriginalConstructor()
    ->getMock();
  $this->delete
    ->expects($this
    ->exactly(2))
    ->method('condition')
    ->will($this
    ->returnSelf());
  $this->delete
    ->expects($this
    ->any())
    ->method('execute')
    ->will($this
    ->returnValue($this->statement));
  $this->connection
    ->expects($this
    ->once())
    ->method('delete')
    ->with($this
    ->equalTo('authmap'))
    ->will($this
    ->returnValue($this->delete));
  $authmap = new Authmap($this->connection);
  $authmap
    ->delete(2, 'some_provider');
}