/** * Sets up the test suite, created required entities. */ protected function setUp() { $this->sharedFixture = array(); // User. $this->user = TestUtils::CreateUser($this->version); $this->sharedFixture['user'] = $this->user; // MCC user. $this->mccUser = TestUtils::CreateUser($this->version); $clientId = $this->mccUser->GetClientId(); $this->mccUser->SetClientId(NULL); $this->sharedFixture['mccUser'] = $this->mccUser; $this->sharedFixture['clientId'] = $clientId; // Test utils. $testUtils = new TestUtils($this->user, $this->version); $this->sharedFixture['testUtils'] = $testUtils; // Add dependencies to requires. for ($i = 0; $i < sizeof($this->requires); $i++) { $entity = $this->requires[$i]; if (isset(AdWordsTestSuite::$DEPENDS[$entity])) { $this->requires = array_unique(array_merge($this->requires, AdWordsTestSuite::$DEPENDS[$entity])); } } // Create required entities. if ($this->IsRequired('CAMPAIGN')) { $this->campaignId = $testUtils->CreateCampaign(); $this->sharedFixture['campaignId'] = $this->campaignId; } if ($this->IsRequired('AD_GROUP')) { $this->adGroupId = $testUtils->CreateAdGroup($this->campaignId); $this->sharedFixture['adGroupId'] = $this->adGroupId; } if ($this->IsRequired('KEYWORD')) { $this->keywordId = $testUtils->CreateKeyword($this->adGroupId); $this->sharedFixture['keywordId'] = $this->keywordId; } if ($this->IsRequired('AD')) { $this->adId = $testUtils->CreateTextAd($this->adGroupId); $this->sharedFixture['adId'] = $this->adId; } if ($this->IsRequired('CAMPAIGN_AD_EXTENSION')) { $this->adExtensionId = $testUtils->CreateLocationExtension($this->campaignId); $this->sharedFixture['adExtensionId'] = $this->adExtensionId; } if ($this->IsRequired('USER_LIST')) { $this->userListId = $testUtils->CreateUserList(); $this->sharedFixture['userListId'] = $this->userListId; } }