Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Updated TLD list for South Africa locale #761

Merged
merged 1 commit into from
Feb 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/Faker/Provider/en_ZA/Internet.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@
class Internet extends \Faker\Provider\Internet
{
protected static $freeEmailDomain = array('gmail.com', 'yahoo.com', 'hotmail.com', 'webmail.co.za', 'vodamail.co.za');
protected static $tld = array('co.za', 'co.za', 'co.za', 'co.za', 'com', 'com', 'net');

/**
* @see https://en.wikipedia.org/wiki/.za
*/
protected static $tld = array(
'co.za', 'co.za', 'co.za', 'co.za', 'com', 'com', 'net', 'gov.za', '.ac.za', '.edu.za', 'law.za', 'mil.za',
'net.za', 'nom.za','org.za', 'school.za', 'ecape.school.za', 'fs.school.za', 'gp.school.za','kzn.school.za',
'.mpm.za', 'ncape.school.za', 'lp.school.za', 'nw.school.za', 'wcape.school.za', 'web.za', 'agric.za', 'nis.za',
'grondar.za',
);
}
32 changes: 32 additions & 0 deletions test/Faker/Provider/en_ZA/InternetTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Faker\Test\Provider\en_ZA;

use Faker\Generator;
use Faker\Provider\en_ZA\Person;
use Faker\Provider\en_ZA\Internet;
use Faker\Provider\en_ZA\Company;

class InternetTest extends \PHPUnit_Framework_TestCase
{

/**
* @var Generator
*/
private $faker;

public function setUp()
{
$faker = new Generator();
$faker->addProvider(new Person($faker));
$faker->addProvider(new Internet($faker));
$faker->addProvider(new Company($faker));
$this->faker = $faker;
}

public function testEmailIsValid()
{
$email = $this->faker->email();
$this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL));
}
}