tester->getClassProperty($entity, 'id'); $property->setValue($entity, $id); $result = $entity->getId(); self::assertEquals($id, $result); } public static function dataGetId(): array { $faker = Factory::create('en_EN'); return [ ['id' => null], ['id' => $faker->randomNumber()], ]; } /** * @dataProvider dataGetTemp * * @throws ReflectionException * @test */ public function getTemp(?float $temp): void { $entity = new History(); $property = $this->tester->getClassProperty($entity, 'temp'); $property->setValue($entity, $temp); $result = $entity->getTemp(); self::assertEquals($temp, $result); } public static function dataGetTemp(): array { $faker = Factory::create('en_EN'); return [ ['temp' => null], ['temp' => $faker->randomFloat()], ]; } /** * @throws ReflectionException * @test */ public function setTemp(): void { $entity = new History(); $property = $this->tester->getClassProperty($entity, 'temp'); $temp = (Factory::create('en_EN'))->randomFloat(); $resultSet = $entity->setTemp($temp); $result = $property->getValue($entity); self::assertEquals($temp, $result); self::assertEquals($entity, $resultSet); } /** * @dataProvider dataGetDateAt * * @throws ReflectionException * @test */ public function getDateAt(?DateTimeInterface $date_at): void { $entity = new History(); $property = $this->tester->getClassProperty($entity, 'date_at'); $property->setValue($entity, $date_at); $result = $entity->getDateAt(); self::assertEquals($date_at, $result); } public static function dataGetDateAt(): array { $faker = Factory::create('en_EN'); return [ ['date_at' => null], ['date_at' => $faker->dateTime()], ]; } /** * @throws ReflectionException * @test */ public function setDateAt(): void { $entity = new History(); $property = $this->tester->getClassProperty($entity, 'date_at'); $date_at = (Factory::create('en_EN'))->dateTime(); $resultSet = $entity->setDateAt($date_at); $result = $property->getValue($entity); self::assertEquals($date_at, $result); self::assertEquals($entity, $resultSet); } }