object = $this->getMockBuilder(PosLinkPayment::class)->getMockForAbstractClass(); $this->assertTrue(class_exists(PosLinkPayment::class)); $this->assertInstanceOf(PosLinkPayment::class, $this->object); } /** * Test property "id" * @dataProvider validIdDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testId(mixed $value): void { $instance = $this->getTestInstance(); $instance->setId($value); self::assertNotNull($instance->getId()); self::assertNotNull($instance->id); self::assertEquals($value, $instance->getId()); self::assertEquals($value, $instance->id); } /** * Test invalid property "id" * @dataProvider invalidIdDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidId(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setId($value); } /** * @return array[] * @throws Exception */ public function validIdDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_id')); } /** * @return array[] * @throws Exception */ public function invalidIdDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_id')); } /** * Test property "expires_at" * @dataProvider validExpiresAtDataProvider * @param mixed $value * * @return void * @throws Exception */ public function testExpiresAt(mixed $value): void { $instance = $this->getTestInstance(); self::assertEmpty($instance->getExpiresAt()); self::assertEmpty($instance->expires_at); $instance->setExpiresAt($value); if (!empty($value)) { self::assertNotNull($instance->getExpiresAt()); self::assertNotNull($instance->expires_at); if ($value instanceof Datetime) { self::assertEquals($value, $instance->getExpiresAt()); self::assertEquals($value, $instance->expires_at); } else { self::assertEquals(new Datetime($value), $instance->getExpiresAt()); self::assertEquals(new Datetime($value), $instance->expires_at); } } } /** * Test invalid property "expires_at" * @dataProvider invalidExpiresAtDataProvider * @param mixed $value * @param string $exceptionClass * * @return void */ public function testInvalidExpiresAt(mixed $value, string $exceptionClass): void { $instance = $this->getTestInstance(); $this->expectException($exceptionClass); $instance->setExpiresAt($value); } /** * @return array[] * @throws Exception */ public function validExpiresAtDataProvider(): array { $instance = $this->getTestInstance(); return $this->getValidDataProviderByType($instance->getValidator()->getRulesByPropName('_expires_at')); } /** * @return array[] * @throws Exception */ public function invalidExpiresAtDataProvider(): array { $instance = $this->getTestInstance(); return $this->getInvalidDataProviderByType($instance->getValidator()->getRulesByPropName('_expires_at')); } }