Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hborras committed Aug 24, 2020
1 parent f45336c commit 57c93a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 59 deletions.
4 changes: 2 additions & 2 deletions tests/TwitterAds/AccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public function testGetAccount($accounts)
{
/** @var Account $firstAccount */
$firstAccount = $accounts->current();
$account = new Account($firstAccount->getId());
$account = new Account(ACCOUNT_ID);
$account->read();
$this->assertEquals($firstAccount->getId(), $account->getId());
$this->assertEquals(ACCOUNT_ID, $account->getId());
return $account;
}

Expand Down
57 changes: 0 additions & 57 deletions tests/TwitterAdsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,61 +90,4 @@ public function testUrl()
$url = $this->api->url('oauth/authorize', array('foo' => 'bar', 'baz' => 'qux'));
$this->assertEquals('https://api.twitter.com/oauth/authorize?foo=bar&baz=qux', $url);
}

public function testAccountsCanBeConvertedToAnArray()
{
$types = [
'id' => function ($v) {
return is_string($v);
},
'name' => function ($v) {
return is_string($v);
},
'salt' => function ($v) {
return is_string($v);
},
'timezone' => function ($v) {
return is_string($v);
},
'timezone_switch_at' => function ($v) {
return $v instanceof DateTimeInterface;
},
'created_at' => function ($v) {
return $v instanceof DateTimeInterface;
},
'updated_at' => function ($v) {
return $v instanceof DateTimeInterface;
},
'deleted' => function ($v) {
return is_bool($v);
},
'approval_status' => function ($v) {
return is_string($v);
},
'properties' => function ($v) {
return is_array($v);
},
'twitterAds' => function ($v) {
return $v instanceof TwitterAds;
},
'business_id' => function ($v) {
return is_string($v) || is_null($v);
},
'business_name' => function ($v) {
return is_string($v) || is_null($v);
},
'industry_type' => function ($v) {
return is_string($v) || is_null($v);
},
];
$accounts = $this->api->getAccounts();

/** @var Account $account */
foreach ($accounts as $account) {
$array = $account->toArray();
foreach ($array as $key => $value) {
$this->assertTrue($types[$key]($value));
}
}
}
}

0 comments on commit 57c93a9

Please sign in to comment.