public function AuthmapTest::testSave in External Authentication 8
Same name and namespace in other branches
- 2.0.x tests/src/Unit/AuthmapTest.php \Drupal\Tests\externalauth\Unit\AuthmapTest::testSave()
Test save() method.
@covers ::save @covers ::__construct
File
- tests/
src/ Unit/ AuthmapTest.php, line 109
Class
- AuthmapTest
- Authmap unit tests.
Namespace
Drupal\Tests\externalauth\UnitCode
public function testSave() {
$account = $this
->createMock('Drupal\\user\\UserInterface');
$merge = $this
->getMockBuilder('Drupal\\Core\\Database\\Query\\Merge')
->disableOriginalConstructor()
->getMock();
$merge
->expects($this
->any())
->method('keys')
->will($this
->returnSelf());
$merge
->expects($this
->any())
->method('fields')
->will($this
->returnSelf());
$merge
->expects($this
->any())
->method('execute')
->will($this
->returnValue($this->statement));
$this->connection
->expects($this
->once())
->method('merge')
->with($this
->equalTo('authmap'))
->will($this
->returnValue($merge));
$authmap = new Authmap($this->connection);
$authmap
->save($account, "test_provider", "test_authname");
}