Example #1
0
 public function testGetContentObject()
 {
     $app = $this->getApp();
     $storage = new Storage($app);
     $content = $storage->getContentObject('pages');
     $this->assertInstanceOf('Bolt\\Content', $content);
     $fields = $app['config']->get('contenttypes/pages/fields');
     $mock = $this->getMock('Bolt\\Content', null, [$app], 'Pages');
     $content = $storage->getContentObject(['class' => 'Pages', 'fields' => $fields]);
     $this->assertInstanceOf('Pages', $content);
     $this->assertInstanceOf('Bolt\\Content', $content);
     // Test that a class not instanceof Bolt\Content fails
     $mock = $this->getMock('stdClass', null, [], 'Failing');
     $this->setExpectedException('Exception', 'Failing does not extend \\Bolt\\Content.');
     $content = $storage->getContentObject(['class' => 'Failing', 'fields' => $fields]);
 }
Example #2
0
 public function setUp()
 {
     $this->resetDb();
     $app = $this->getApp();
     $app['config']->set('general/changelog/enabled', true);
     $this->addSomeContent();
     $storage = new Storage($app);
     $content = $storage->getContentObject('pages');
     $content['contentid'] = 1;
     $storage->saveContent($content, 'pages');
 }
Example #3
0
 public function testGetChangelog()
 {
     $app = $this->getApp();
     $app['config']->set('general/changelog/enabled', true);
     $storage = new Storage($app);
     $content = $storage->getContentObject('pages');
     $storage->saveContent($content, 'pages');
     $logs = $app['logger.manager.change']->getChangeLog(array('limit' => 1, 'offset' => 0, 'order' => 'id'));
     $logs2 = $app['logger.manager.change']->getChangeLog(array('limit' => 1));
     $this->assertEquals(1, count($logs));
     $this->assertEquals(1, count($logs2));
 }