-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
164 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
namespace Payum\Stripe\Tests\Action\Api; | ||
|
||
use Payum\Core\Action\ActionInterface; | ||
use Payum\Core\ApiAwareInterface; | ||
use Payum\Stripe\Action\Api\CreatePlanAction; | ||
use Payum\Stripe\Keys; | ||
use Payum\Stripe\Request\Api\CreatePlan; | ||
|
||
class CreatePlanActionTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function shouldImplementsActionInterface() | ||
{ | ||
$rc = new \ReflectionClass(CreatePlanAction::class); | ||
|
||
$this->assertTrue($rc->isSubclassOf(ActionInterface::class)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldImplementsApiAwareInterface() | ||
{ | ||
$rc = new \ReflectionClass(CreatePlanAction::class); | ||
|
||
$this->assertTrue($rc->isSubclassOf(ApiAwareInterface::class)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function couldBeConstructedWithoutAnyArguments() | ||
{ | ||
new CreatePlanAction(); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldAllowSetKeysAsApi() | ||
{ | ||
$action = new CreatePlanAction(); | ||
|
||
$action->setApi(new Keys('publishableKey', 'secretKey')); | ||
} | ||
|
||
/** | ||
* @test | ||
* | ||
* @expectedException \Payum\Core\Exception\UnsupportedApiException | ||
*/ | ||
public function throwNotSupportedApiIfNotKeysGivenAsApi() | ||
{ | ||
$action = new CreatePlanAction(); | ||
|
||
$action->setApi('not keys instance'); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldSupportCreatePlanRequestWithArrayAccessModel() | ||
{ | ||
$action = new CreatePlanAction(); | ||
|
||
$this->assertTrue($action->supports(new CreatePlan([]))); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldNotSupportCreatePlanRequestWithNotArrayAccessModel() | ||
{ | ||
$action = new CreatePlanAction(); | ||
|
||
$this->assertFalse($action->supports(new CreatePlan(new \stdClass()))); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldNotSupportNotCreatePlanRequest() | ||
{ | ||
$action = new CreatePlanAction(); | ||
|
||
$this->assertFalse($action->supports(new \stdClass())); | ||
} | ||
|
||
/** | ||
* @test | ||
* | ||
* @expectedException \Payum\Core\Exception\RequestNotSupportedException | ||
* @expectedExceptionMessage Action CreatePlanAction is not supported the request stdClass. | ||
*/ | ||
public function throwRequestNotSupportedIfNotSupportedGiven() | ||
{ | ||
$action = new CreatePlanAction(); | ||
|
||
$action->execute(new \stdClass()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace Payum\Stripe\Tests\Request\Api; | ||
|
||
use Payum\Core\Request\Generic; | ||
use Payum\Stripe\Request\Api\CreateCustomer; | ||
|
||
class CreateCustomerTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function shouldBeSubClassOfGeneric() | ||
{ | ||
$rc = new \ReflectionClass(CreateCustomer::class); | ||
|
||
$this->assertTrue($rc->isSubclassOf(Generic::class)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function couldBeConstructedWithModelAsFirstArgument() | ||
{ | ||
new CreateCustomer($model = []); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace Payum\Stripe\Tests\Request\Api; | ||
|
||
use Payum\Core\Request\Generic; | ||
use Payum\Stripe\Request\Api\CreatePlan; | ||
|
||
class CreatePlanTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function shouldBeSubClassOfGeneric() | ||
{ | ||
$rc = new \ReflectionClass(CreatePlan::class); | ||
|
||
$this->assertTrue($rc->isSubclassOf(Generic::class)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function couldBeConstructedWithModelAsFirstArgument() | ||
{ | ||
new CreatePlan($model = []); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters