Skip to content

Improve test consistency #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 1, 2020
Merged
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
1 change: 0 additions & 1 deletion test/Faker/Provider/ar_JO/InternetTest.php
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@

final class InternetTest extends TestCase
{

/**
* @var Generator
*/
1 change: 0 additions & 1 deletion test/Faker/Provider/ar_SA/InternetTest.php
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@

final class InternetTest extends TestCase
{

/**
* @var Generator
*/
1 change: 0 additions & 1 deletion test/Faker/Provider/at_AT/PaymentTest.php
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@

final class PaymentTest extends TestCase
{

/**
* @var Generator
*/
1 change: 0 additions & 1 deletion test/Faker/Provider/bg_BG/PaymentTest.php
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@

final class PaymentTest extends TestCase
{

/**
* @var Generator
*/
6 changes: 5 additions & 1 deletion test/Faker/Provider/bn_BD/PersonTest.php
Original file line number Diff line number Diff line change
@@ -8,6 +8,11 @@

final class PersonTest extends TestCase
{
/**
* @var Generator
*/
private $faker;

protected function setUp(): void
{
$faker = new Generator();
@@ -27,4 +32,3 @@ public function testIfFirstNameFemaleCanReturnData()
$this->assertNotEmpty($firstNameFemale);
}
}
?>
13 changes: 11 additions & 2 deletions test/Faker/Provider/cs_CZ/PersonTest.php
Original file line number Diff line number Diff line change
@@ -9,14 +9,23 @@

final class PersonTest extends TestCase
{
public function testBirthNumber()
/**
* @var Generator
*/
private $faker;

protected function setUp(): void
{
$faker = new Generator();
$faker->addProvider(new Person($faker));
$faker->addProvider(new Miscellaneous($faker));
$this->faker = $faker;
}

public function testBirthNumber()
{
for ($i = 0; $i < 1000; $i++) {
$birthNumber = $faker->birthNumber();
$birthNumber = $this->faker->birthNumber();
$birthNumber = str_replace('/', '', $birthNumber);

// check date
1 change: 0 additions & 1 deletion test/Faker/Provider/da_DK/InternetTest.php
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@

final class InternetTest extends TestCase
{

/**
* @var Generator
*/
2 changes: 0 additions & 2 deletions test/Faker/Provider/de_AT/AddressTest.php
Original file line number Diff line number Diff line change
@@ -17,9 +17,7 @@ final class AddressTest extends TestCase
protected function setUp(): void
{
$faker = new Generator();

$faker->addProvider(new Address($faker));

$this->faker = $faker;
}

1 change: 0 additions & 1 deletion test/Faker/Provider/de_AT/InternetTest.php
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@

final class InternetTest extends TestCase
{

/**
* @var Generator
*/
1 change: 0 additions & 1 deletion test/Faker/Provider/de_AT/PaymentTest.php
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@

final class PaymentTest extends TestCase
{

/**
* @var Generator
*/
1 change: 0 additions & 1 deletion test/Faker/Provider/de_AT/PhoneNumberTest.php
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@

final class PhoneNumberTest extends TestCase
{

/**
* @var Generator
*/
3 changes: 1 addition & 2 deletions test/Faker/Provider/de_CH/AddressTest.php
Original file line number Diff line number Diff line change
@@ -9,9 +9,8 @@

final class AddressTest extends TestCase
{

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

3 changes: 1 addition & 2 deletions test/Faker/Provider/de_CH/InternetTest.php
Original file line number Diff line number Diff line change
@@ -10,9 +10,8 @@

final class InternetTest extends TestCase
{

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

5 changes: 4 additions & 1 deletion test/Faker/Provider/de_CH/PersonTest.php
Original file line number Diff line number Diff line change
@@ -9,6 +9,9 @@

final class PersonTest extends TestCase
{
/**
* @var Generator
*/
private $faker;

protected function setUp(): void
@@ -31,4 +34,4 @@ public function testAhv13Number()
$this->assertMatchesRegularExpression('/^756\.([0-9]{4})\.([0-9]{4})\.([0-9]{2})$/', $ahv);
$this->assertTrue(Ean::isValid(str_replace('.', '', $ahv)));
}
}
}
3 changes: 1 addition & 2 deletions test/Faker/Provider/de_CH/PhoneNumberTest.php
Original file line number Diff line number Diff line change
@@ -8,9 +8,8 @@

final class PhoneNumberTest extends TestCase
{

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

1 change: 0 additions & 1 deletion test/Faker/Provider/de_DE/InternetTest.php
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@

final class InternetTest extends TestCase
{

/**
* @var Generator
*/
3 changes: 3 additions & 0 deletions test/Faker/Provider/el_GR/PhoneNumberTest.php
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@

final class PhoneNumberTest extends TestCase
{
/**
* @var Generator
*/
private $faker;

protected function setUp(): void
76 changes: 37 additions & 39 deletions test/Faker/Provider/en_AU/AddressTest.php
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
<?php

namespace Faker\Provider\en_AU;
namespace Faker\Test\Provider\en_AU;

use Faker\Generator;
use Faker\Provider\en_AU\Address;
use Faker\Test\TestCase;

final class AddressTest extends TestCase
{

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

protected function setUp(): void
{
$faker = new Generator();
$faker->addProvider(new Address($faker));
$this->faker = $faker;
}

public function testCityPrefix()
{
$cityPrefix = $this->faker->cityPrefix();
$this->assertNotEmpty($cityPrefix);
$this->assertIsString($cityPrefix);
$this->assertMatchesRegularExpression('/[A-Z][a-z]+/', $cityPrefix);
}

public function testStreetSuffix()
{
$streetSuffix = $this->faker->streetSuffix();
$this->assertNotEmpty($streetSuffix);
$this->assertIsString($streetSuffix);
$this->assertMatchesRegularExpression('/[A-Z][a-z]+/', $streetSuffix);
}

public function testState()
{
$state = $this->faker->state();
$this->assertNotEmpty($state);
$this->assertIsString($state);
$this->assertMatchesRegularExpression('/[A-Z][a-z]+/', $state);
}
/**
* @var Generator
*/
private $faker;

protected function setUp(): void
{
$faker = new Generator();
$faker->addProvider(new Address($faker));
$this->faker = $faker;
}

public function testCityPrefix()
{
$cityPrefix = $this->faker->cityPrefix();
$this->assertNotEmpty($cityPrefix);
$this->assertIsString($cityPrefix);
$this->assertMatchesRegularExpression('/[A-Z][a-z]+/', $cityPrefix);
}

public function testStreetSuffix()
{
$streetSuffix = $this->faker->streetSuffix();
$this->assertNotEmpty($streetSuffix);
$this->assertIsString($streetSuffix);
$this->assertMatchesRegularExpression('/[A-Z][a-z]+/', $streetSuffix);
}

public function testState()
{
$state = $this->faker->state();
$this->assertNotEmpty($state);
$this->assertIsString($state);
$this->assertMatchesRegularExpression('/[A-Z][a-z]+/', $state);
}
}

?>
105 changes: 51 additions & 54 deletions test/Faker/Provider/en_CA/AddressTest.php
Original file line number Diff line number Diff line change
@@ -1,69 +1,66 @@
<?php

namespace Faker\Provider\en_CA;
namespace Faker\Test\Provider\en_CA;

use Faker\Generator;
use Faker\Provider\en_CA\Address;
use Faker\Test\TestCase;

final class AddressTest extends TestCase
{
/**
* @var Generator
*/
private $faker;

/**
* @var Faker\Generator
*/
private $faker;
protected function setUp(): void
{
$faker = new Generator();
$faker->addProvider(new Address($faker));
$this->faker = $faker;
}

protected function setUp(): void
{
$faker = new Generator();
$faker->addProvider(new Address($faker));
$this->faker = $faker;
}
/**
* Test the validity of province
*/
public function testProvince()
{
$province = $this->faker->province();
$this->assertNotEmpty($province);
$this->assertIsString($province);
$this->assertMatchesRegularExpression('/[A-Z][a-z]+/', $province);
}

/**
* Test the validity of province
*/
public function testProvince()
{
$province = $this->faker->province();
$this->assertNotEmpty($province);
$this->assertIsString($province);
$this->assertMatchesRegularExpression('/[A-Z][a-z]+/', $province);
}
/**
* Test the validity of province abbreviation
*/
public function testProvinceAbbr()
{
$provinceAbbr = $this->faker->provinceAbbr();
$this->assertNotEmpty($provinceAbbr);
$this->assertIsString($provinceAbbr);
$this->assertMatchesRegularExpression('/^[A-Z]{2}$/', $provinceAbbr);
}

/**
* Test the validity of province abbreviation
*/
public function testProvinceAbbr()
{
$provinceAbbr = $this->faker->provinceAbbr();
$this->assertNotEmpty($provinceAbbr);
$this->assertIsString($provinceAbbr);
$this->assertMatchesRegularExpression('/^[A-Z]{2}$/', $provinceAbbr);
}
/**
* Test the validity of postcode letter
*/
public function testPostcodeLetter()
{
$postcodeLetter = $this->faker->randomPostcodeLetter();
$this->assertNotEmpty($postcodeLetter);
$this->assertIsString($postcodeLetter);
$this->assertMatchesRegularExpression('/^[A-Z]{1}$/', $postcodeLetter);
}

/**
* Test the validity of postcode letter
*/
public function testPostcodeLetter()
{
$postcodeLetter = $this->faker->randomPostcodeLetter();
$this->assertNotEmpty($postcodeLetter);
$this->assertIsString($postcodeLetter);
$this->assertMatchesRegularExpression('/^[A-Z]{1}$/', $postcodeLetter);
}

/**
* Test the validity of Canadian postcode
*/
public function testPostcode()
{
$postcode = $this->faker->postcode();
$this->assertNotEmpty($postcode);
$this->assertIsString($postcode);
$this->assertMatchesRegularExpression('/^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/', $postcode);
}
/**
* Test the validity of Canadian postcode
*/
public function testPostcode()
{
$postcode = $this->faker->postcode();
$this->assertNotEmpty($postcode);
$this->assertIsString($postcode);
$this->assertMatchesRegularExpression('/^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/', $postcode);
}
}

?>
Loading