/** * Method to test JTableContent::check(). * * @since 1.6 */ public function testCheck() { // Mock the database table class. $dbStub = $this->getMock('JDatabaseMySQL', array('getTableFields'), array(array())); $dbStub->expects($this->any())->method('getTableFields')->will($this->returnValue(array())); /* $appStub = $this->getMock('JApplication', array('stringURLSafe')); $appStub::staticExpects($this->any()) ->method('stringURLSafe') ->will($this->returnValue('')); // We need phpunit 3.5 for this to work. */ $table = new JTableContent($dbStub); $this->assertThat($table->check(), $this->isFalse(), 'Line: ' . __LINE__ . ' Checking an empty table should fail.'); /* $table->title = 'Test Title'; $this->assertThat( $table->check(), $this->isFalse(), 'Line: '.__LINE__.' Checking the table with just the title should fail.' ); $this->assertThat( $table->alias, $this->equalTo('Test Title'), 'Line: '.__LINE__.' An empty alias should assume the value of the title.' ); $table->publish_up = '2010-01-12 00:00:00'; $table->publish_down = '2010-01-11 00:00:00'; */ $this->markTestIncomplete('More cases to test.'); }
function addArticle($dataContent, $data) { $db = JFactory::getDbo(); $contentTable = new JTableContent($db); $contentTable->bind($dataContent); if ($contentTable->check()) { $contentTable->store(); if ($contentTable->id) { $data->article_id = $contentTable->id; addMinicck($data); } } }