diff --git a/CHANGELOG.md b/CHANGELOG.md index 84c3038..b9f28cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,4 +12,10 @@ * Decreased required PHP version ### Fixed -* Fixed `IGG-88` droid name \ No newline at end of file +* Fixed `IGG-88` droid name + +## v1.2.0 (23-01-2018) + +### Added +* Added new characters, droids, planets and species from Episode VII and Episode VIII +* Added new squadron formatter \ No newline at end of file diff --git a/README.md b/README.md index c6b3b56..21cc474 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,14 @@ $faker->species; // Wookiee $faker->vehicle; // Millennium Falcon ``` +### `HydrefLab\JediFaker\Provider\Squadron` +``` +$faker->squadron; // Green +$faker->squadronName; // Blue Squadron +$faker->pilot; // Red Leader or Blue #7 +$faker->pilotRank; // Pilot +``` + ## Contributing Contributions are welcome! Please, read [CONTRIBUTING][] for details. diff --git a/src/Factory.php b/src/Factory.php index 7bab5e9..15ec01c 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -11,7 +11,7 @@ class Factory extends FakerFactory * @var array */ protected static $jediProviders = [ - 'Character', 'Droid', 'Movie', 'Planet', 'Species', 'Vehicle', + 'Character', 'Droid', 'Movie', 'Planet', 'Species', 'Squadron', 'Vehicle', ]; /** diff --git a/src/Provider/Character.php b/src/Provider/Character.php index 56bb75a..5bcf595 100644 --- a/src/Provider/Character.php +++ b/src/Provider/Character.php @@ -11,6 +11,7 @@ class Character extends Base */ protected static $darkSide = [ 'Darth Maul', 'Darth Sidious', 'Darth Vader', 'Dooku', + 'Grievous', 'Kylo Ren', 'Snoke', ]; @@ -39,23 +40,32 @@ class Character extends Base * @var array */ protected static $characters = [ - 'Amilyn Holdo', - 'Bail Prestor Organa', 'Boba Fett', 'Bossk', 'Bren Derlin', - 'C-3PO', 'Captain Phasma', 'Chewbacca', 'Crix Madine', + 'Amilyn Holdo', 'Armitage Hux', 'Athgar Heece', + 'Bail Prestor Organa', 'Bala-Tik', 'Bazine Netal', 'Boba Fett', 'Bobbajo', 'Bollie Prindel', 'Bossk', + 'Bren Derlin', + 'C\'ai Threnalli', 'C-3PO', 'Caluan Ematt', 'Chewbacca', 'Cratinus', 'Crix Madine', 'Crokind Shand', 'Crusher Roodown', + 'Datoo', 'DJ', 'Dopheld Mitaka', + 'Edrison Peavey', 'Ello Asty', 'Finis Valorum', 'Finn', 'Firmus Piett', - 'Gial Ackbar', 'Grievous', + 'Gial Ackbar', 'Goss Toowers', 'Grummgar', 'Gwellis Bagnoro', 'Han Solo', - 'Jabba the Hutt', 'Jan Dodonna', 'Jango Fett', 'Jar Jar Binks', - 'Kendal Ozzel', - 'Lando Calrissian', 'Lobot', - 'Mas Amedda', 'Maz Kanata', 'Mon Mothma', - 'Nute Gunray', - 'Padmé Amidala', 'Poe Dameron', 'Poggle the Lesser', - 'R2-D2', 'Rune Haako', - 'Sheev Palpatine', 'Shmi Skywalker', 'Sebulba', 'Sly Moore', - 'Taun We', - 'Watto', 'Wedge Antilles', 'Wicket Warrick', 'Wilhuff Tarkin', - 'Zam Wesell', + 'Ilco Munica', 'Infrablue Zedbeddy Coggins', + 'Jabba the Hutt', 'Jan Dodonna', 'Jango Fett', 'Jar Jar Binks', 'Jashco Phurus', 'Jess Pava', + 'Kalonia', 'Kaydel Ko Connix ', 'Kendal Ozzel', 'Korr Sella', + 'Lando Calrissian', 'Lanever Villecham ', 'Larma D\'Acy', 'Lobot', 'Lor San Tekka', + 'Mas Amedda', 'Maz Kanata', 'Moden Canady', 'Mon Mothma', 'Munduri', + 'Nien Nunb', 'Nute Gunray', + 'Padmé Amidala', 'Paige Tico', 'Phasma', 'Poe Dameron', 'Poggle the Lesser', 'Prashee', 'Praster Ommlen', 'Pru Sweevant', + 'R2-D2', 'Razoo Qin-Fee', 'Rose Tico', 'Rune Haako', + 'Sebulba', 'Sheev Palpatine', 'Shmi Skywalker', 'Sidon Ithano', 'Sonsigo', 'Slowen Lo', 'Sly Moore', 'Strono Tuggs', + 'Sudswater Dillifay Glon', + 'Tallissan Lintra', 'Taslin Brance', 'Taun We', 'Tasu Leech', 'Taybin Ralorsa', 'Temiri Blagg', 'Temmin Wexley', + 'Thanisson', + 'Quiggold', + 'U.O. Statura', 'Ubert Quaril', 'Unamo', 'Unkar Plutt', + 'Vober Dand', 'Volzang Li-Thrull', + 'Watto', 'Wedge Antilles', 'Wicket Warrick', 'Wilhuff Tarkin', 'Wollivan', + 'Zam Wesell', 'Zuvio', ]; /** diff --git a/src/Provider/Droid.php b/src/Provider/Droid.php index aaabdcf..b116b26 100644 --- a/src/Provider/Droid.php +++ b/src/Provider/Droid.php @@ -11,12 +11,17 @@ class Droid extends Base */ protected static $droids = [ '2-1B', '4-LOM', '8D8', - 'BB-8', + 'BB-8', 'BB-9E', 'B-U4D', 'C-3PO', - 'EV-9D9', + 'EGL-21', 'EV-9D9', 'FA-4', + 'GA-97', + 'HURID-327', 'IGG-88', + 'ME-8D9', + 'PZ-4CO', 'R2-D2', 'R2-Q5', 'R5-D4', + 'SE8', 'TC-14', ]; diff --git a/src/Provider/Planet.php b/src/Provider/Planet.php index af20e0a..f28b998 100644 --- a/src/Provider/Planet.php +++ b/src/Provider/Planet.php @@ -12,7 +12,7 @@ class Planet extends Base protected static $planets = [ 'Ahch-To', 'Alderaan', 'Bespin', - 'Cantonica', 'Cato Neimoidia', 'Coruscant', + 'Cantonica', 'Cato Neimoidia', 'Coruscant', 'Crait', 'D\'Qar', 'Dagobah', 'Endor', 'Felucia', diff --git a/src/Provider/Species.php b/src/Provider/Species.php index 0aacde5..cf72d07 100644 --- a/src/Provider/Species.php +++ b/src/Provider/Species.php @@ -24,7 +24,7 @@ class Species extends Base 'Luggabeast', 'Mirialan', 'Mon Calamari', 'Nautolan', 'Neimoidian', 'Nikto', - 'Pantoran', 'Pau\'an', + 'Pantoran', 'Pau\'an', 'Porg', 'Quarren', 'Rodian', 'Saurin', 'Sullustan', diff --git a/src/Provider/Squadron.php b/src/Provider/Squadron.php new file mode 100644 index 0000000..6370e05 --- /dev/null +++ b/src/Provider/Squadron.php @@ -0,0 +1,89 @@ +generator->parse(static::randomElement(static::$squadron)); + } + + /** + * @return string + */ + public function squadronName(): string + { + return $this->generator->parse(static::randomElement(static::squadronFormat())); + } + + /** + * @return string + */ + public function pilot(): string + { + $pilot = $this->generator->parse(static::randomElement(static::$pilotFormat)); + + return false !== strpos($pilot, 'Pilot') + ? str_replace('Pilot', '#' . static::numberBetween(1, 12), $pilot) + : $pilot; + } + + /** + * @return string + */ + public function pilotRank(): string + { + return $this->generator->parse(static::randomElement(static::$pilotRank)); + } + + /** + * @return array + */ + protected static function squadronFormat(): array + { + return ['{{squadron}} ' . static::$squadronWord]; + } +} diff --git a/tests/Provider/SquadronTest.php b/tests/Provider/SquadronTest.php new file mode 100644 index 0000000..516e1fa --- /dev/null +++ b/tests/Provider/SquadronTest.php @@ -0,0 +1,39 @@ +assertNotNull($faker->squadron); + } + + public function testSquadronNameContainsSquadronWord() + { + $faker = Factory::create(); + $this->assertContains('Squadron', $faker->squadronName); + } + + public function testSquadronDoesNotContainSquadronWord() + { + $faker = Factory::create(); + $this->assertNotContains('Squadron', $faker->squadron); + } + + public function testPilotIsNotNull() + { + $faker = Factory::create(); + $this->assertNotNull($faker->pilot); + } + + public function testRankIsNotNull() + { + $faker = Factory::create(); + $this->assertNotNull($faker->pilotRank); + } +}