You are here

public function RestrictIpServiceTest::setUp in Restrict IP 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Service/RestrictIpServiceTest.php \Drupal\Tests\restrict_ip\Unit\Service\RestrictIpServiceTest::setUp()
  2. 3.x tests/src/Unit/Service/RestrictIpServiceTest.php \Drupal\Tests\restrict_ip\Unit\Service\RestrictIpServiceTest::setUp()

*

Overrides UnitTestCase::setUp

File

tests/src/Unit/Service/RestrictIpServiceTest.php, line 25

Class

RestrictIpServiceTest
@coversDefaultClass \Drupal\restrict_ip\Service\RestrictIpService @group restrict_ip

Namespace

Drupal\Tests\restrict_ip\Unit\Service

Code

public function setUp() {
  $this->currentUser = $this
    ->getMockBuilder('Drupal\\Core\\Session\\AccountProxyInterface')
    ->disableOriginalConstructor()
    ->getMock();
  $this->currentPathStack = $this
    ->getMockBuilder('Drupal\\Core\\Path\\CurrentPathStack')
    ->disableOriginalConstructor()
    ->getMock();
  $this->requestStack = $this
    ->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack')
    ->disableOriginalConstructor()
    ->getMock();
  $this->request = $this
    ->getMockBuilder('Symfony\\Component\\HttpFoundation\\Request')
    ->disableOriginalConstructor()
    ->getMock();
  $this->mapper = $this
    ->getMockBuilder('Drupal\\restrict_ip\\Mapper\\RestrictIpMapper')
    ->disableOriginalConstructor()
    ->getMock();
  $this->mapper
    ->expects($this
    ->any())
    ->method('getWhitelistedPaths')
    ->willReturn([
    '/node/1',
  ]);
  $this->mapper
    ->expects($this
    ->any())
    ->method('getBlacklistedPaths')
    ->willReturn([
    '/node/1',
  ]);
  $this->pathMatcher = $this
    ->getMockbuilder('Drupal\\Core\\Path\\PathMatcherInterface')
    ->disableOriginalConstructor()
    ->getMock();
}