private function getMemcacheMock() { $mock = new MemcachedMock(); $mock->setThrowExceptionsOnFailure(true); $mock->addServer('127.0.0.1', 11211); $mock->setLogger(new MemcachedLogger(new TestLogger())); return $mock; }
public function testMultipleAssertFailures() { $mock = new MemcachedMock(); $mock->setThrowExceptionsOnFailure(false); $logger = new TestLogger(); $mock->setLogger(new MemcachedLogger($logger)); $mockReflection = new \ReflectionClass($mock); $method = $mockReflection->getMethod('assertConnected'); $method->setAccessible(true); $this->assertFalse($method->invokeArgs($mock, [])); $method = $mockReflection->getMethod('assertScalarValue'); $method->setAccessible(true); $this->assertFalse($method->invokeArgs($mock, [[]])); $mock->setThrowExceptionsOnFailure(true); $errorLog = $mock->getLogger()->getLogger()->getErrorLog(); $this->assertInternalType('array', $errorLog); $this->assertCount(2, $errorLog); }