PHPUnit Unable to Mock GoogleAdsRow:class

191 views
Skip to first unread message

Andjel Boskovic

unread,
Jul 13, 2021, 10:29:12 AM7/13/21
to AdWords API and Google Ads API Forum
Hi,

I'm writing a PHPUnit test for code using Google Ads API Library.

"googleads/google-ads-php": "^10.0
"google/protobuf": "^3.17"
"phpunit/phpunit": "^8.5"
php version: 7.4

While trying to mock GoogleAdsRow::class I'm getting an error.

EG:

<?php
namespace GoogleAds;
use Google\Ads\GoogleAds\V8\Services\GoogleAdsRow;
use PHPUnit\Framework\TestCase;
class GoogleAdsBugTest extends TestCase {
  public function testBug(): void
  {
    $googleAdsRow = $this->createMock(GoogleAdsRow::class);
  }
}

I've also tried building as:
$googleAdsRow = new GoogleAdsRow();
$googleAdsRow->setAdGroup($adGroup);
$googleAdsRow->setMetrics($metrics);
$googleAdsRow->setSegments($segments);

But is also resolves as an error.

Are you aware of this issue? Is there a way to work around it?

Let me know if you need any more details.

Best,
Andjel

Google Ads API Forum Advisor

unread,
Jul 14, 2021, 11:15:59 AM7/14/21
to andjel....@fishingbooker.com, adwor...@googlegroups.com
Hi Andjel,

For assistance with the PHP library you may want to go to the Google Ads API PHP Github issue tracker.

Regards,

Google Logo
Aryeh Baker
Google Ads API Team
 


ref:_00D1U1174p._5004Q2KbrzZ:ref
Reply all
Reply to author
Forward
0 new messages