public function addGoal($counter, $name, $url, $action = null, $id = null)
 {
     $goal = new Goal();
     $goal->setType('action');
     $goal->setName($name);
     $goal->setClass(0);
     $conditions = new Conditions();
     $condition = new Condition();
     $condition->setType('exact');
     $condition->setUrl($url);
     $conditions->add($condition);
     $goal->setConditions($conditions);
     /** @var Counter $counter */
     $this->client->goals()->addGoal($counter->getId(), $goal);
 }
 public function testGet()
 {
     $fixtures = Goals::$goalFixtures;
     $condition = new Models\Condition();
     $condition->setUrl($fixtures['goal']['conditions'][0]['url'])->setType($fixtures['goal']['conditions'][0]['type']);
     $conditions = new Models\Conditions();
     $conditions->add($condition);
     $goal = new Models\Goal();
     $goal->setId($fixtures['goal']['id'])->setName($fixtures['goal']['name'])->setType($fixtures['goal']['type'])->setFlag($fixtures['goal']['flag'])->setConditions($conditions)->setClass($fixtures['goal']['class']);
     $getConditions = $goal->getConditions()->getAll();
     $this->assertEquals($fixtures["goal"]["id"], $goal->getId());
     $this->assertEquals($fixtures["goal"]["name"], $goal->getName());
     $this->assertEquals($fixtures["goal"]["type"], $goal->getType());
     $this->assertEquals($fixtures["goal"]["flag"], $goal->getFlag());
     $this->assertEquals($fixtures["goal"]["class"], $goal->getClass());
     $this->assertEquals($fixtures["goal"]["conditions"][0]["type"], $getConditions[0]->getType());
     $this->assertEquals($fixtures["goal"]["conditions"][0]["url"], $getConditions[0]->getUrl());
 }