public function FeedTest::testSetState in Feeds 8.3
@covers ::setState
File
- tests/
src/ Kernel/ Entity/ FeedTest.php, line 384
Class
- FeedTest
- @coversDefaultClass \Drupal\feeds\Entity\Feed @group feeds
Namespace
Drupal\Tests\feeds\Kernel\EntityCode
public function testSetState() {
$feed = $this
->createFeed($this->feedType
->id());
// Mock a state object.
$state = $this
->createMock(StateInterface::class);
// Set state on the fetch stage.
$feed
->setState(StateInterface::FETCH, $state);
$this
->assertSame($state, $feed
->getState(StateInterface::FETCH));
// Clear a state.
$feed
->setState(StateInterface::FETCH, NULL);
$this
->assertNotSame($state, $feed
->getState(StateInterface::FETCH));
$this
->assertInstanceOf(StateInterface::class, $feed
->getState(StateInterface::FETCH));
}