-
-
Save trikitrok/140295bdcd101ce92499b216bcd0b43d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <?php | |
| namespace Trovit\B2B\AdClick\Tests\unit\Domain; | |
| use PHPUnit\Framework\TestCase; | |
| use Prophecy\Argument; | |
| use Trovit\B2B\AdClick\Domain\ClickValidation; | |
| use Trovit\B2B\AdClick\Domain\ClickValidator; | |
| class ClickValidationTest extends TestCase | |
| { | |
| private $click; | |
| private $validator1; | |
| private $validator2; | |
| private $clickValidation; | |
| protected function setUp() | |
| { | |
| $this->click = []; | |
| $this->validator1 = $this->prophesize(ClickValidator::class); | |
| $this->validator2 = $this->prophesize(ClickValidator::class); | |
| $this->clickValidation = new ClickValidation( | |
| [$this->validator1->reveal(), $this->validator2->reveal()] | |
| ); | |
| } | |
| /** @test */ | |
| public function when_any_validator_returns_false_the_click_is_not_valid() | |
| { | |
| $this->validator1->isValid($this->click)->willReturn(false); | |
| $this->validator2->isValid($this->click)->willReturn(true); | |
| $isValid = $this->clickValidation->isValid($this->click); | |
| $this->assertFalse($isValid); | |
| } | |
| /** @test */ | |
| public function when_all_validators_return_truse_the_click_is_valid() | |
| { | |
| $this->validator1->isValid($this->click)->willReturn(true); | |
| $this->validator2->isValid($this->click)->willReturn(true); | |
| $isValid = $this->clickValidation->isValid($this->click); | |
| $this->assertTrue($isValid); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment