public function testSave() { $cacheId = 'test_id'; $data = 'test data'; $tags = ['tag1', 'tag2']; $this->assertTrue($this->_model->save($data, $cacheId, $tags)); $actualData = $this->_model->load($cacheId); $this->assertEquals($data, $actualData); $actualMetadata = $this->_model->getMetadatas($cacheId); $this->arrayHasKey('tags', $actualMetadata); $this->assertEquals($tags, $actualMetadata['tags']); }
/** * @param mixed $cacheId * @param array $expectedInput * @param array|null $mongoOutput * @param array|bool $expected * @dataProvider getMetadatasDataProvider */ public function testGetMetadatas($cacheId, $expectedInput, $mongoOutput, $expected) { $this->_collection->expects($this->once())->method('findOne')->with($expectedInput)->will($this->returnValue($mongoOutput)); $actual = $this->_model->getMetadatas($cacheId); $this->assertEquals($expected, $actual); }