19 private $reinitableConfigMock;
29 private $configWriterMock;
34 private $objectManagerHelper;
44 private $tokenPath =
'analytics/general/token';
51 $this->reinitableConfigMock = $this->getMockBuilder(ReinitableConfigInterface::class)
52 ->disableOriginalConstructor()
55 $this->configMock = $this->getMockBuilder(ScopeConfigInterface::class)
56 ->disableOriginalConstructor()
59 $this->configWriterMock = $this->getMockBuilder(WriterInterface::class)
60 ->disableOriginalConstructor()
63 $this->objectManagerHelper =
new ObjectManagerHelper($this);
65 $this->tokenModel = $this->objectManagerHelper->getObject(
66 AnalyticsToken::class,
68 'reinitableConfig' => $this->reinitableConfigMock,
69 'config' => $this->configMock,
70 'configWriter' => $this->configWriterMock,
71 'tokenPath' => $this->tokenPath,
83 $this->configWriterMock
84 ->expects($this->once())
86 ->with($this->tokenPath,
$value);
88 $this->reinitableConfigMock
89 ->expects($this->once())
93 $this->assertTrue($this->tokenModel->storeToken(
$value));
104 ->expects($this->once())
106 ->with($this->tokenPath)
109 $this->assertSame(
$value, $this->tokenModel->getToken());
117 $this->assertFalse($this->tokenModel->isTokenExist());
120 ->expects($this->once())
122 ->with($this->tokenPath)
123 ->willReturn(
'0000');
124 $this->assertTrue($this->tokenModel->isTokenExist());