| @@ 7-56 (lines=50) @@ | ||
| 4 | ||
| 5 | use PhpSpec\ObjectBehavior; |
|
| 6 | ||
| 7 | class RefreshTokenSpec extends ObjectBehavior |
|
| 8 | { |
|
| 9 | public function let() |
|
| 10 | { |
|
| 11 | $this->setUsername('test'); |
|
| 12 | $this->setRefreshToken(); |
|
| 13 | } |
|
| 14 | ||
| 15 | public function it_is_initializable() |
|
| 16 | { |
|
| 17 | $this->shouldHaveType('Gesdinet\JWTRefreshTokenBundle\Document\RefreshToken'); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function it_has_a_custom_refresh_token() |
|
| 21 | { |
|
| 22 | $this->setRefreshToken('token'); |
|
| 23 | $this->getRefreshToken()->shouldBe('token'); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function it_has_username() |
|
| 27 | { |
|
| 28 | $this->getUsername()->shouldBe('test'); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function it_has_valid() |
|
| 32 | { |
|
| 33 | $date = new \DateTime(); |
|
| 34 | $this->setValid($date); |
|
| 35 | ||
| 36 | $this->getValid()->shouldBe($date); |
|
| 37 | } |
|
| 38 | ||
| 39 | public function it_is_valid() |
|
| 40 | { |
|
| 41 | $date = new \DateTime(); |
|
| 42 | $date->modify('+1 day'); |
|
| 43 | $this->setValid($date); |
|
| 44 | ||
| 45 | $this->isValid()->shouldBe(true); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function it_is_not_valid() |
|
| 49 | { |
|
| 50 | $date = new \DateTime(); |
|
| 51 | $date->modify('-1 day'); |
|
| 52 | $this->setValid($date); |
|
| 53 | ||
| 54 | $this->isValid()->shouldBe(false); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| @@ 7-56 (lines=50) @@ | ||
| 4 | ||
| 5 | use PhpSpec\ObjectBehavior; |
|
| 6 | ||
| 7 | class RefreshTokenSpec extends ObjectBehavior |
|
| 8 | { |
|
| 9 | public function let() |
|
| 10 | { |
|
| 11 | $this->setUsername('test'); |
|
| 12 | $this->setRefreshToken(); |
|
| 13 | } |
|
| 14 | ||
| 15 | public function it_is_initializable() |
|
| 16 | { |
|
| 17 | $this->shouldHaveType('Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken'); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function it_has_a_custom_refresh_token() |
|
| 21 | { |
|
| 22 | $this->setRefreshToken('token'); |
|
| 23 | $this->getRefreshToken()->shouldBe('token'); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function it_has_username() |
|
| 27 | { |
|
| 28 | $this->getUsername()->shouldBe('test'); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function it_has_valid() |
|
| 32 | { |
|
| 33 | $date = new \DateTime(); |
|
| 34 | $this->setValid($date); |
|
| 35 | ||
| 36 | $this->getValid()->shouldBe($date); |
|
| 37 | } |
|
| 38 | ||
| 39 | public function it_is_valid() |
|
| 40 | { |
|
| 41 | $date = new \DateTime(); |
|
| 42 | $date->modify('+1 day'); |
|
| 43 | $this->setValid($date); |
|
| 44 | ||
| 45 | $this->isValid()->shouldBe(true); |
|
| 46 | } |
|
| 47 | ||
| 48 | public function it_is_not_valid() |
|
| 49 | { |
|
| 50 | $date = new \DateTime(); |
|
| 51 | $date->modify('-1 day'); |
|
| 52 | $this->setValid($date); |
|
| 53 | ||
| 54 | $this->isValid()->shouldBe(false); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||