TV infrared sensors are an all-or-nothing operational device: A TV's IR sensor works if it responds to a properly functioning remote control. You can test an IR sensor on a TV set by checking if the TV responds to commands from an operational remote control designed for the TV set or universal remote control. TV IR ports receive commands transmitted by the remote control via infrared light.
Use the Existing Remote
You can use the TV's stock remote control to check if the TV's IR port is working by using the remote to turn the set on or off. The TV's IR port works if it responds to remote commands. The TV needs to be powered for the test to work. Try installing new batteries in the remote control before testing. Additionally, make sure there aren't any objects obstructing the path between the remote and the TV IR ports. Wiping off the IR ports on the TV and remote may also help.
Use a Universal Remote
You can rule out a malfunctioning remote control by testing the TV with a universal remote. Universal remote controls are designed to work with all TV sets and may require entering a device code to work with your TV set. If the TV set powers on and off with the universal remote control the TV IR port works fine, the manufacturer's remote may be broken.