protected function AuthmapTest::setUp in External Authentication 8
Same name in this branch
- 8 tests/src/Unit/AuthmapTest.php \Drupal\Tests\externalauth\Unit\AuthmapTest::setUp()
- 8 tests/src/Kernel/AuthmapTest.php \Drupal\Tests\externalauth\Kernel\AuthmapTest::setUp()
Same name and namespace in other branches
- 2.0.x tests/src/Unit/AuthmapTest.php \Drupal\Tests\externalauth\Unit\AuthmapTest::setUp()
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ AuthmapTest.php, line 50
Class
- AuthmapTest
- Authmap unit tests.
Namespace
Drupal\Tests\externalauth\UnitCode
protected function setUp() {
parent::setUp();
// Create a Mock database connection object.
$this->connection = $this
->getMockBuilder('Drupal\\Core\\Database\\Connection')
->disableOriginalConstructor()
->getMock();
// Create a Mock Statement object.
$this->statement = $this
->getMockBuilder('Drupal\\Core\\Database\\Driver\\sqlite\\Statement')
->disableOriginalConstructor()
->getMock();
// Create a Mock Select object and set expectations.
$this->select = $this
->getMockBuilder('Drupal\\Core\\Database\\Query\\Select')
->disableOriginalConstructor()
->getMock();
$this->select
->expects($this
->any())
->method('fields')
->will($this
->returnSelf());
$this->select
->expects($this
->any())
->method('condition')
->will($this
->returnSelf());
$this->select
->expects($this
->any())
->method('range')
->will($this
->returnSelf());
$this->select
->expects($this
->any())
->method('orderBy')
->will($this
->returnSelf());
$this->select
->expects($this
->any())
->method('execute')
->will($this
->returnValue($this->statement));
$this->connection
->expects($this
->any())
->method('select')
->will($this
->returnValue($this->select));
// Create a Mock Delete object and set expectations.
$this->delete = $this
->getMockBuilder('Drupal\\Core\\Database\\Query\\Delete')
->disableOriginalConstructor()
->getMock();
$this->delete
->expects($this
->any())
->method('condition')
->will($this
->returnSelf());
$this->delete
->expects($this
->any())
->method('execute')
->will($this
->returnValue($this->statement));
}