public function testNoNewTweets() { // model with all current tweets $model = $this->getMockBuilder('AMWhalen\\ArchiveMyTweets\\Model')->disableOriginalConstructor()->getMock(); // Calling $model->addTweets() will now return 0 $model->expects($this->any())->method('addTweets')->will($this->returnValue(0)); // expect model to not add any new tweets $importer = new Importer(); $output = $importer->importJSON(dirname(__FILE__) . '/json', $model); $this->assertTrue($this->didFindString($output, 'No new tweets found.')); }
/** * Imports tweets from the JSON files in a downloaded Twitter Archive * * @param string $directory The directory to look for Twitter .js files. * @return string Returns a string with informational output. */ public function importJSON($directory) { $importer = new Importer(); return $importer->importJSON($directory, $this->model); }