Bolt\Tests\Controller\Backend\LogTest::testChangeRecord PHP Method

testChangeRecord() public method

public testChangeRecord ( )
    public function testChangeRecord()
    {
        $this->getService('config')->set('general/changelog/enabled', true);
        $this->setRequest(Request::create('/bolt/editcontent/pages/1'));
        /** @var \Bolt\Legacy\Content $record */
        $record = $this->getService('storage')->getContent('pages/1');
        $record->setValue('title', 'Clippy was here!');
        $this->getService('storage')->saveContent($record, 'Saving');
        // Test valid entry
        $this->setRequest(Request::create('/bolt/changelog/pages/1/1'));
        $response = $this->controller()->changeRecord($this->getRequest(), 'pages', 1, 1);
        $context = $response->getContext();
        $this->assertInstanceOf('Bolt\\Storage\\Entity\\LogChange', $context['context']['entry']);
        // Test non-existing entry
        $this->setExpectedException('Symfony\\Component\\HttpKernel\\Exception\\HttpException', 'exist');
        $this->setRequest(Request::create('/bolt/changelog/pages/1/100'));
        $response = $this->controller()->changeRecord($this->getRequest(), 'pages', 1, 100);
        $response->getContext();
    }