public function testApply() { $stateKey = 'sk'; $this->registry->expects($this->once())->method('registry')->with($this->equalTo('current_category'))->will($this->returnValue($this->category)); $this->stateKeyGenerator->expects($this->once())->method('toString')->with($this->equalTo($this->category))->will($this->returnValue($stateKey)); $this->state->expects($this->any())->method('getFilters')->will($this->returnValue([$this->filter])); $this->filter->expects($this->once())->method('getFilter')->will($this->returnValue($this->abstractFilter)); $this->filter->expects($this->once())->method('getValueString')->will($this->returnValue('t')); $this->abstractFilter->expects($this->once())->method('getRequestVar')->will($this->returnValue('t')); $result = $this->model->apply(); $this->assertInstanceOf('\\Magento\\Catalog\\Model\\Layer', $result); }