示例#1
0
 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);
 }
示例#3
0
 public function __construct()
 {
     $this->query = Model::query()->select('tags.*')->appliedToALivePage();
 }
示例#4
0
 public function __construct()
 {
     $this->query = Model::query()->select('tags.*');
 }
示例#5
0
 public function testSetNameUpdatesSlug()
 {
     $tag = new Tag();
     $tag->setName('Test test');
     $this->assertEquals('test-test', $tag->getSlug());
 }
示例#6
0
 /**
  * @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();
 }