public function testQueryIsBuilt() { $query = m::mock(Builder::class); $tag = new Tag(['id' => 1]); $filter = new Filter($tag); $query->shouldReceive('leftJoin')->with('pages_tags as pt_without-0', m::on(function () { return true; }))->andReturnSelf()->shouldReceive('on')->with('pages.id', '=', 'pt_without-0.page_id')->andReturnSelf()->shouldReceive('on')->with('pt_without-0.tag_id', '=', $tag->getId())->andReturnSelf()->shouldReceive('whereNull')->with('pt_without-0.page_id'); $filter->build($query); }
public function boot() { parent::boot(); Models\Asset::observe(CreationLogObserver::class); Models\AssetVersion::observe(CreationLogObserver::class); Models\Page::observe(CreationLogObserver::class); Models\PageVersion::observe(CreationLogObserver::class); Models\Asset::observe(SetSiteObserver::class); Models\Group::observe(SetSiteObserver::class); Models\Page::observe(SetSiteObserver::class); Models\Tag::observe(SetSiteObserver::class); Models\URL::observe(SetSiteObserver::class); Models\Page::observe(DeletionLogObserver::class); }
public function __construct() { $this->query = Model::query()->select('tags.*')->appliedToALivePage(); }
public function __construct() { $this->query = Model::query()->select('tags.*'); }
public function testSetNameUpdatesSlug() { $tag = new Tag(); $tag->setName('Test test'); $this->assertEquals('test-test', $tag->getSlug()); }
/** * @param string $slug * @param string $group * * @return TagInterface */ public function findBySlugAndGroup($slug, $group = null) { return $this->model->where(Model::ATTR_SLUG, '=', $slug)->where(Model::ATTR_GROUP, '=', $group)->first(); }