Mika56 / PHP-SPF-Check

Simple library to check an IP address against a domain's SPF record
MIT License
44 stars 25 forks source link

Test DNSRecordGetter with mock DNS #12

Closed AlexCarmel closed 8 years ago

AlexCarmel commented 8 years ago

Currently we don't have any tests to test DNSRecordGetter. We can use PHPUnit Bridge from symphony framework to mock DNS records. To test dns_get_record we can use:

DnsMock::withMockedHosts(array(
    'example.com' => array(
        array(
            'type' => 'A',
            'ip' => '1.2.3.4',
        )
    ),
));
Mika56 commented 8 years ago

I didn't know about this mock, I was looking at starting a Docker container with some DNS server, but this looks way easier :D Might take a look before the end of the week