示例#1
0
 public function testMergeIntoSelf()
 {
     $tag = Tag::firstOrCreate(['name' => 'Tag 1']);
     $this->assertSame(1, Tag::count());
     $tag->merge($tag);
     $this->assertSame(1, Tag::count());
 }
示例#2
0
 /**
  * @testdox Tags can be added to Job Lists.
  * @test
  */
 public function tags()
 {
     $type = new \App\Model\JobType();
     $type->save();
     $jobList = new JobList();
     $jobList->type_id = $type->id;
     $jobList->save();
     $jobList->addTags('one,two');
     $this->assertEquals(2, Tag::count());
 }
 public function home()
 {
     $this->view->title = $this->view->site_name;
     $this->view->asset_count = Asset::count();
     $this->view->user_count = User::count();
     $this->view->crew_count = Crew::count();
     $this->view->job_list_count = JobList::count();
     $this->view->job_count = Job::count();
     $this->view->tag_count = Tag::count();
     return $this->view;
 }
示例#4
0
 /**
  * @testdox Assets can be tagged.
  * @test
  */
 public function tags()
 {
     $asset = new Asset();
     $asset->identifier = 'TEST123';
     $asset->save();
     $this->assertEquals(0, Tag::count());
     $this->assertEquals(0, $asset->tags->count());
     $asset->addTags('One,Two');
     $asset->load('tags');
     $this->assertEquals(2, Tag::count());
     $this->assertEquals(2, $asset->tags->count());
     $asset->addTags('One,Two,Three');
     $asset->load('tags');
     $this->assertEquals(3, $asset->tags->count());
     // Make sure empty tags aren't added.
     $asset->addTags('One,Two,,Three');
     $asset->load('tags');
     $this->assertEquals(3, $asset->tags->count());
 }