/** * Constructor * * @throws ApplicationException */ public function __construct(IDataSource $source = null, IRenderer $renderer = null, Settings $config = null) { $config = $config instanceof Settings ? $config : Settings::instance(); $this->validateSettings($config); $this->feedTitle = $config->feed_title; $this->dataRowsLimit = $config->post_max_number; $this->fullContent = $config->post_full_content; $this->source = $source ?: DataSource::getFacadeRoot(); $this->renderer = $renderer ?: Renderer::getFacadeRoot(); }
/** * Set up the test case */ public function setUp() { parent::setUp(); /** * Create a mock-up of the Settings object * TODO: find a better way to mock this object */ $config = Settings::instance(); $config->setAttribute('feed_title', 'test'); /** * Set up the data source for the feed */ App::bind('KoderHut\\RssFeedster\\DataSource', function ($app) { return new MockDataSource(); }); /** * Set up the feed renderer */ App::bind('KoderHut\\RssFeedster\\Renderer', function ($app) { $config = ['description' => 'feed description', 'title' => 'feed title', 'category' => 'feed category', 'copyright' => 'feed copyright', 'language' => 'feed language', 'link' => 'feed url']; return new MockJsonRenderer($config); }); $this->feed = new Feedster(null, null, $config); }