Skip to content

Commit

Permalink
Merge pull request #1011 from carusogabriel/refactoring-tests
Browse files Browse the repository at this point in the history
Refactoring tests
  • Loading branch information
jaypatel512 authored Feb 14, 2018
2 parents 263fe31 + c378f6d commit 219390b
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tests/PayPal/Test/Api/CreditCardHistoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testGetterSetters()
$cardHistory->setCreditCards(array($this->cards['partial'], $this->cards['full']));
$cardHistory->setCount(2);

$this->assertEquals(2, count($cardHistory->getCreditCards()));
$this->assertCount(2, $cardHistory->getCreditCards());
}


Expand Down
2 changes: 1 addition & 1 deletion tests/PayPal/Test/Cache/AuthorizationCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testCachePull()
{
$result = AuthorizationCache::pull(array('cache.enabled' => true, 'cache.FileName' => AuthorizationCacheTest::CACHE_FILE), 'clientId');
$this->assertNotNull($result);
$this->assertTrue(is_array($result));
$this->assertInternalType('array', $result);
$this->assertEquals('clientId', $result['clientId']);
$this->assertEquals('accessToken', $result['accessTokenEncrypted']);
$this->assertEquals('tokenCreateTime', $result['tokenCreateTime']);
Expand Down
4 changes: 2 additions & 2 deletions tests/PayPal/Test/Common/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ public function testSetterMagicMethod()
$obj->obj = '{}';
$obj->objs = array('{}');
$this->assertEquals("other", $obj->something);
$this->assertTrue(is_array($obj->else));
$this->assertInternalType('array', $obj->else);
$this->assertNull($obj->there);
$this->assertEquals('{}', $obj->obj);
$this->assertTrue(is_array($obj->objs));
$this->assertInternalType('array', $obj->objs);
$this->assertEquals('{}', $obj->objs[0]);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/PayPal/Test/Common/PayPalModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function testEmptyNullConversion($field2, $matches)
{
$c1 = new SimpleModelTestClass();
$c1->setField1("a")->setField2($field2);
$this->assertTrue(strpos($c1->toJSON(), "field2") !== !$matches);
$this->assertNotSame(strpos($c1->toJSON(), "field2"), !$matches);
}

public function getProvider()
Expand Down Expand Up @@ -332,8 +332,8 @@ public function testGetList($input, $count, $expected)
$this->assertEquals($expected, $result);
if ($input) {
$this->assertNotNull($result);
$this->assertTrue(is_array($result));
$this->assertEquals($count, sizeof($result));
$this->assertInternalType('array', $result);
$this->assertCount($count, $result);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/PayPal/Test/Core/PayPalCredentialManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function tearDown()
public function testGetInstance()
{
$instance = $this->object->getInstance($this->config);
$this->assertTrue($instance instanceof PayPalCredentialManager);
$this->assertInstanceOf('PayPal\Core\PayPalCredentialManager', $instance);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions tests/PayPal/Test/Core/PayPalHttpConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testHeaderFunctions()
$o->addHeader('key2', 'value');
$o->addHeader('key2', 'overwritten');

$this->assertEquals(2, count($o->getHeaders()));
$this->assertCount(2, $o->getHeaders());
$this->assertEquals('overwritten', $o->getHeader('key2'));
$this->assertNull($o->getHeader('key3'));

Expand All @@ -54,11 +54,11 @@ public function testHeaderFunctions()
$o->addHeader('key2', 'value');
$o->addHeader('key2', 'and more', false);

$this->assertEquals(2, count($o->getHeaders()));
$this->assertCount(2, $o->getHeaders());
$this->assertEquals('value;and more', $o->getHeader('key2'));

$o->removeHeader('key2');
$this->assertEquals(1, count($o->getHeaders()));
$this->assertCount(1, $o->getHeaders());
$this->assertNull($o->getHeader('key2'));
}

Expand All @@ -71,7 +71,7 @@ public function testCurlOpts()
$o->setCurlOptions(array('k' => 'v'));

$curlOpts = $o->getCurlOptions();
$this->assertEquals(1, count($curlOpts));
$this->assertCount(1, $curlOpts);
$this->assertEquals('v', $curlOpts['k']);
}

Expand All @@ -80,12 +80,12 @@ public function testRemoveCurlOpts()
$o = new PayPalHttpConfig();
$o->setCurlOptions(array('k' => 'v'));
$curlOpts = $o->getCurlOptions();
$this->assertEquals(1, count($curlOpts));
$this->assertCount(1, $curlOpts);
$this->assertEquals('v', $curlOpts['k']);

$o->removeCurlOption('k');
$curlOpts = $o->getCurlOptions();
$this->assertEquals(0, count($curlOpts));
$this->assertCount(0, $curlOpts);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ public function testGetTransactions($agreement)
$params = array('start_date' => date('Y-m-d', strtotime('-15 years')), 'end_date' => date('Y-m-d', strtotime('+5 days')));
$result = Agreement::searchTransactions($agreement->getId(), $params, $this->apiContext, $this->mockPayPalRestCall);
$this->assertNotNull($result);
$this->assertTrue(is_array($result->getAgreementTransactionList()));
$this->assertTrue(sizeof($result->getAgreementTransactionList()) > 0);
$this->assertInternalType('array', $result->getAgreementTransactionList());
$this->assertGreaterThan(0, sizeof($result->getAgreementTransactionList()));
$list = $result->getAgreementTransactionList();
$first = $list[0];
$this->assertEquals($first->getTransactionId(), $agreement->getId());
Expand Down
2 changes: 1 addition & 1 deletion tests/PayPal/Test/Functional/Api/PayoutsFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function testCreate()
$this->assertEquals(PayoutsFunctionalTest::$batchId, $result->getBatchHeader()->getSenderBatchHeader()->getSenderBatchId());
$this->assertEquals('SUCCESS', $result->getBatchHeader()->getBatchStatus());
$items = $result->getItems();
$this->assertTrue(sizeof($items) > 0);
$this->assertGreaterThan(0, sizeof($items));
$item = $items[0];
$this->assertEquals('UNCLAIMED', $item->getTransactionStatus());
return $result;
Expand Down
2 changes: 1 addition & 1 deletion tests/PayPal/Test/Functional/Api/WebhookFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testGetSubscribedEventTypes($webhook)
{
$result = WebhookEventType::subscribedEventTypes($webhook->getId(), $this->apiContext, $this->mockPayPalRestCall);
$this->assertNotNull($result);
$this->assertEquals(2, sizeof($result->getEventTypes()));
$this->assertCount(2, $result->getEventTypes());
return $result;
}

Expand Down

0 comments on commit 219390b

Please sign in to comment.