diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d28767f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: php + +php: + - 7.1 + - 7.2 + +before_script: + - curl -s http://getcomposer.org/installer | php + - php composer.phar install --dev --prefer-source + +script: + - php vendor/bin/phpunit \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5002868..9e4f9a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,4 @@ -#CHANGELOG \ No newline at end of file +#CHANGELOG + +## 14-01-2017 - v1.0.0 +* Initial version \ No newline at end of file diff --git a/README.md b/README.md index 55901de..c6b3b56 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Faker extension for Star Wars junkie.

+[![Build Status](https://travis-ci.org/HydrefLab/jedi-faker.svg?branch=master)](https://travis-ci.org/HydrefLab/jedi-faker) + ## Installation ```sh diff --git a/composer.json b/composer.json index 3e9a8c3..219256b 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,8 @@ { "name": "hydreflab/jedi-faker", + "type": "library", "description": "Faker extension for Star Wars junkie", + "keywords": ["faker", "faker-extension", "fixtures", "data", "star-wars"], "license": "MIT", "support": { "issues": "https://github.com/HydrefLab/jedi-faker/issues", @@ -16,10 +18,17 @@ "php": ">=7.1", "fzaninotto/faker": "~1.4" }, + "require-dev": { + "phpunit/phpunit": "~6.0" + }, "autoload": { "psr-4": { "HydrefLab\\JediFaker\\": "src/" } }, - "minimum-stability": "dev" + "autoload-dev": { + "psr-4": { + "HydrefLab\\JediFaker\\Test\\": "tests/" + } + } } diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..1df7aaa --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,10 @@ + + + ./tests + + + + ./tests/ + + + diff --git a/src/Factory.php b/src/Factory.php index 82d281e..7bab5e9 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -18,7 +18,7 @@ class Factory extends FakerFactory * @param string $locale * @return Generator */ - public static function create(string $locale = self::DEFAULT_LOCALE): Generator + public static function create($locale = self::DEFAULT_LOCALE): Generator { $generator = parent::create($locale); diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php new file mode 100644 index 0000000..201a277 --- /dev/null +++ b/tests/FactoryTest.php @@ -0,0 +1,16 @@ +assertInstanceOf(Generator::class, $faker); + } +} diff --git a/tests/Provider/CharacterTest.php b/tests/Provider/CharacterTest.php new file mode 100644 index 0000000..72e981e --- /dev/null +++ b/tests/Provider/CharacterTest.php @@ -0,0 +1,40 @@ +faker = Factory::create(); + } + + public function testLightSideIsNotNull() + { + $this->assertNotNull($this->faker->lightSide); + } + + public function testDarkSideIsNotNull() + { + $this->assertNotNull($this->faker->darkSide); + } + + public function testCharacterIsNotNull() + { + $this->assertNotNull($this->faker->character); + } + + public function testQuotesNotNull() + { + $this->assertNotNull($this->faker->quote); + } +} diff --git a/tests/Provider/DroidTest.php b/tests/Provider/DroidTest.php new file mode 100644 index 0000000..72b58bc --- /dev/null +++ b/tests/Provider/DroidTest.php @@ -0,0 +1,15 @@ +assertNotNull($faker->droid); + } +} diff --git a/tests/Provider/MovieTest.php b/tests/Provider/MovieTest.php new file mode 100644 index 0000000..39d1e51 --- /dev/null +++ b/tests/Provider/MovieTest.php @@ -0,0 +1,43 @@ +faker = Factory::create(); + } + + public function testEpisodeIsNotNull() + { + $this->assertNotNull($this->faker->episode); + } + + public function testEpisodeReturnsFirstEpisodeTitle() + { + $this->assertEquals('Episode I: The Phantom Menace', $this->faker->episode(1)); + } + + public function testEpisodeOpeningCrawlIsNotNull() + { + $this->assertNotNull($this->faker->episodeOpeningCrawl); + } + + public function testEpisodeOpeningCrawlReturnsFirstEpisodeCrawl() + { + $this->assertEquals( + "Turmoil has engulfed the\r\nGalactic Republic. The taxation\r\nof trade routes to outlying star\r\nsystems is in dispute.\r\n\r\nHoping to resolve the matter\r\nwith a blockade of deadly\r\nbattleships, the greedy Trade\r\nFederation has stopped all\r\nshipping to the small planet\r\nof Naboo.\r\n\r\nWhile the Congress of the\r\nRepublic endlessly debates\r\nthis alarming chain of events,\r\nthe Supreme Chancellor has\r\nsecretly dispatched two Jedi\r\nKnights, the guardians of\r\npeace and justice in the\r\ngalaxy, to settle the conflict....", + $this->faker->episodeOpeningCrawl(1) + ); + } +} diff --git a/tests/Provider/PlanetTest.php b/tests/Provider/PlanetTest.php new file mode 100644 index 0000000..d23cbef --- /dev/null +++ b/tests/Provider/PlanetTest.php @@ -0,0 +1,15 @@ +assertNotNull($faker->planet); + } +} diff --git a/tests/Provider/SpeciesTest.php b/tests/Provider/SpeciesTest.php new file mode 100644 index 0000000..92adca5 --- /dev/null +++ b/tests/Provider/SpeciesTest.php @@ -0,0 +1,15 @@ +assertNotNull($faker->species); + } +} diff --git a/tests/Provider/VehicleTest.php b/tests/Provider/VehicleTest.php new file mode 100644 index 0000000..1afec58 --- /dev/null +++ b/tests/Provider/VehicleTest.php @@ -0,0 +1,15 @@ +assertNotNull($faker->vehicle); + } +}