Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jun 26, 2021
1 parent 48b739b commit 8759ed5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ protected function setUp(): void
$this->markTestSkipped('Tests can only be run with memcached extension 2.1.0 or lower, or 3.0.0b1 or higher');
}

$this->memcached = $this->createMock(\Memcached::class);
$r = new \ReflectionClass(\Memcached::class);
$methodsToMock = array_map(function ($m) { return $m->name; }, $r->getMethods(\ReflectionMethod::IS_PUBLIC));
$methodsToMock = array_diff($methodsToMock, ['getDelayed','getDelayedByKey']);

$this->memcached = $this->getMockBuilder(\Memcached::class)
->disableOriginalConstructor()
->setMethods($methodsToMock)
->getMock();

$this->storage = new MemcachedSessionHandler(
$this->memcached,
['prefix' => self::PREFIX, 'expiretime' => self::TTL]
Expand Down

0 comments on commit 8759ed5

Please sign in to comment.