/** * Tests User->addSitesAnalysis() User->removeSitesAnalysis() User->getSitesAnalyses(). */ public function testAddSitesAnalysis() { $sitesAnalysis[0] = new Site(); $sitesAnalysis[1] = new Site(); $sitesAnalysis[2] = new Site(); $this->assertTrue($this->user->getSitesAnalyses() instanceof Collection); $this->assertEquals(0, $this->user->getSitesAnalyses()->count()); $this->user->addSitesAnalysis($sitesAnalysis[0]); $this->assertEquals(1, $this->user->getSitesAnalyses()->count()); $this->assertTrue($this->user->getSitesAnalyses()->contains($sitesAnalysis[0])); $this->assertFalse($this->user->getSitesAnalyses()->contains($sitesAnalysis[1])); $this->assertFalse($this->user->getSitesAnalyses()->contains($sitesAnalysis[2])); $this->user->addSitesAnalysis($sitesAnalysis[1]); $this->assertEquals(2, $this->user->getSitesAnalyses()->count()); $this->assertTrue($this->user->getSitesAnalyses()->contains($sitesAnalysis[0])); $this->assertTrue($this->user->getSitesAnalyses()->contains($sitesAnalysis[1])); $this->assertFalse($this->user->getSitesAnalyses()->contains($sitesAnalysis[2])); $this->user->removeSitesAnalysis($sitesAnalysis[2]); $this->assertEquals(2, $this->user->getSitesAnalyses()->count()); $this->assertTrue($this->user->getSitesAnalyses()->contains($sitesAnalysis[0])); $this->assertTrue($this->user->getSitesAnalyses()->contains($sitesAnalysis[1])); $this->assertFalse($this->user->getSitesAnalyses()->contains($sitesAnalysis[2])); $this->user->removeSitesAnalysis($sitesAnalysis[0]); $this->assertEquals(1, $this->user->getSitesAnalyses()->count()); $this->assertFalse($this->user->getSitesAnalyses()->contains($sitesAnalysis[0])); $this->assertTrue($this->user->getSitesAnalyses()->contains($sitesAnalysis[1])); $this->assertFalse($this->user->getSitesAnalyses()->contains($sitesAnalysis[2])); }