Skip to content

Commit

Permalink
Merge pull request #59 from tipoff/wolfrednicolas/feature/rename-clas…
Browse files Browse the repository at this point in the history
…ses-and-add-unit-test

Rename classes and add unit test
  • Loading branch information
drewroberts authored Mar 16, 2021
2 parents a9ad7b3 + d541349 commit 7486fbc
Show file tree
Hide file tree
Showing 46 changed files with 577 additions and 374 deletions.
35 changes: 0 additions & 35 deletions database/factories/EscapeRoomMarketFactory.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@
namespace Tipoff\EscapeRoom\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Tipoff\EscapeRoom\Models\EscapeRoomLocation;
use Tipoff\EscapeRoom\Models\EscaperoomLocation;

class EscapeRoomLocationFactory extends Factory
class EscaperoomLocationFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = EscapeRoomLocation::class;
protected $model = EscaperoomLocation::class;

/**
* Define the model's default state.
*
* @return array
* @throws \Exception
*/
public function definition()
{
return [
'location_id' => randomOrCreate(app('location')),
'corporate' => $this->faker->boolean,
'booking_cutoff' => $this->faker->numberBetween(1, 127),
'creator_id' => randomOrCreate(app('user')),
'team_image_id' => randomOrCreate(app('image')),
'updater_id' => randomOrCreate(app('user'))
];
}
Expand Down
23 changes: 23 additions & 0 deletions database/factories/EscaperoomMarketFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace Tipoff\EscapeRoom\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Tipoff\EscapeRoom\Models\EscaperoomMarket;

class EscaperoomMarketFactory extends Factory
{
protected $model = EscaperoomMarket::class;

public function definition()
{
return [
'market_id' => randomOrCreate(app('market')),
'corporate' => $this->faker->boolean,
'creator_id' => randomOrCreate(app('user')),
'updater_id' => randomOrCreate(app('user'))
];
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
<?php
<?php

declare(strict_types=1);

namespace Tipoff\EscapeRoom\Database\Factories;

use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Factories\Factory;
use Tipoff\EscapeRoom\Models\Rate;
use Tipoff\EscapeRoom\Models\EscaperoomRate;

class RateFactory extends Factory
class EscaperoomRateFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Rate::class;
protected $model = EscaperoomRate::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$sentence = $this->faker->sentence;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
<?php
<?php

declare(strict_types=1);

namespace Tipoff\EscapeRoom\Database\Factories;

use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Factories\Factory;
use Tipoff\EscapeRoom\Models\Theme;
use Tipoff\EscapeRoom\Models\EscaperoomTheme;

class ThemeFactory extends Factory
class EscaperoomThemeFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Theme::class;
protected $model = EscaperoomTheme::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$name = $this->faker->name;
Expand All @@ -42,6 +32,10 @@ public function definition()
'puzzle_level' => $this->faker->numberBetween(1, 5),
'escape_rate' => $this->faker->numberBetween(1, 100),
'supervision_id' => randomOrCreate(app('supervision')),
'poster_image_id' => randomOrCreate(app('image')),
'icon_id' => randomOrCreate(app('image')),
'image_id' => randomOrCreate(app('image')),
'video_id' => randomOrCreate(app('video')),
'creator_id' => randomOrCreate(app('user')),
'updater_id' => randomOrCreate(app('user'))
];
Expand Down
14 changes: 2 additions & 12 deletions database/factories/RoomFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,14 @@

class RoomFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Room::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'location_id' => randomOrCreate(app('location')),
'theme_id' => randomOrCreate(app('theme')),
'rate_id' => randomOrCreate(app('rate')),
'escaperoom_theme_id' => randomOrCreate(app('escaperoom_theme')),
'escaperoom_rate_id' => randomOrCreate(app('escaperoom_rate')),
'supervision_id' => randomOrCreate(app('supervision')),
'opened_at' => $this->faker->dateTimeBetween('-1 years', '+3 months'),
'closed_at' => null,
Expand Down
12 changes: 1 addition & 11 deletions database/factories/SupervisionFactory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

declare(strict_types=1);

Expand All @@ -10,18 +10,8 @@

class SupervisionFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Supervision::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$sentence = $this->faker->unique()->sentence;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRatesTable extends Migration
class CreateEscaperoomRatesTable extends Migration
{
public function up()
{
Schema::create('rates', function (Blueprint $table) {
Schema::create('escaperoom_rates', function (Blueprint $table) {
$table->id();
$table->string('name')->unique(); // Internal reference name
$table->string('slug')->unique()->index();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Tipoff\Locations\Models\Location;

class CreateEscapeRoomMarkets extends Migration
class CreateEscaperoomMarkets extends Migration
{
public function up()
{
Schema::create('escape_room_markets', function (Blueprint $table) {
Schema::create('escaperoom_markets', function (Blueprint $table) {
$table->id();

$table->foreignIdFor(app('market'))->unique(); // NOTE - unique() added -- there should be exactly one record per market
$table->boolean('corporate')->default(true);

$table->text('rooms_content')->nullable(); // Market specific content for /escape-rooms page. Written in Markdown.
$table->text('faq_content')->nullable(); // Frequently Asked Questions about the market (such as where to park at each location in the market). Written in Markdown.
$table->text('competitors_content')->nullable(); // Nice paragraph about the other escape rooms in each market. First used on /escape-rooms page. Written in Markdown.

$table->foreignIdFor(Location::class)->unique(); // NOTE - unique() added -- there should be exactly one record per location!

$table->foreignIdFor(app('user'), 'creator_id');
$table->foreignIdFor(app('user'), 'updater_id');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Tipoff\Locations\Models\Location;

class CreateEscapeRoomLocations extends Migration
class CreateEscaperoomLocations extends Migration
{
public function up()
{
Schema::create('escape_room_locations', function (Blueprint $table) {
Schema::create('escaperoom_locations', function (Blueprint $table) {
$table->id();
$table->boolean('corporate')->default(true); // Mark false for Miami & DC
$table->foreignIdFor(app('location'))->unique(); // NOTE - unique() added -- there should be exactly one record per location!
$table->boolean('corporate')->default(true);
$table->boolean('covid')->default(false); // Mark true if location closed due to COVID-19

$table->string('team_names')->nullable();
$table->foreignIdFor(Image::class, 'team_image_id')->nullable();
$table->foreignIdFor(app('image'), 'team_image_id')->nullable();

$table->unsignedTinyInteger('booking_cutoff'); // Minutes before a game/slot to cutoff the booking window.
$table->boolean('covid')->default(false); // Mark true if location closed due to COVID-19
$table->boolean('use_iframe')->default(false); // If yes, use the booking iframe below
$table->text('booking_iframe')->nullable(); // Iframe code for Resova/Bookeo or other 3rd parting booking software
$table->foreignIdFor(Location::class)->unique(); // NOTE - unique() added -- there should be exactly one record per location!
$table->text('booking_iframe')->nullable(); // Iframe code for 3rd parting booking software

$table->foreignIdFor(app('user'), 'creator_id');
$table->foreignIdFor(app('user'), 'updater_id');
$table->timestamps();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
use Illuminate\Support\Facades\Schema;
use Tipoff\EscapeRoom\Models\Supervision;

class CreateThemesTable extends Migration
class CreateEscaperoomThemesTable extends Migration
{
public function up()
{
Schema::create('themes', function (Blueprint $table) {
Schema::create('escaperoom_themes', function (Blueprint $table) {
$table->id();
$table->string('slug')->unique()->index();
$table->string('name')->unique();
Expand All @@ -28,7 +28,7 @@ public function up()
$table->unsignedTinyInteger('puzzle_level')->nullable(); // 1-5 scale
$table->unsignedTinyInteger('escape_rate')->nullable(); // 0-100% scale
$table->foreignIdFor(app('image'))->nullable();
$table->foreignIdFor(app('video'))->nullable()->unique();
$table->foreignIdFor(app('video'))->nullable();
$table->foreignIdFor(app('image'), 'poster_image_id')->nullable();
$table->foreignIdFor(app('image'), 'icon_id')->nullable();
$table->foreignIdFor(app('supervision'), 'supervision_id');
Expand Down
7 changes: 2 additions & 5 deletions database/migrations/2020_02_18_110000_create_rooms_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Tipoff\EscapeRoom\Models\Rate;
use Tipoff\EscapeRoom\Models\Supervision;
use Tipoff\EscapeRoom\Models\Theme;

class CreateRoomsTable extends Migration
{
Expand All @@ -16,8 +13,8 @@ public function up()
Schema::create('rooms', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(app('location'))->index();
$table->foreignIdFor(app('theme'))->index();
$table->foreignIdFor(app('rate'))->index(); // Default pricing rate structure for the room. Can be ovveridden by schedules & slots.
$table->foreignIdFor(app('escaperoom_theme'))->index();
$table->foreignIdFor(app('escaperoom_rate'))->index(); // Default pricing rate structure for the room. Can be ovveridden by schedules & slots.
$table->foreignIdFor(app('supervision'));
$table->date('opened_at');
$table->date('closed_at')->nullable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function up()
{
Schema::create('image_theme', function (Blueprint $table) {
$table->foreignIdFor(app('image'))->index();
$table->foreignIdFor(app('theme'))->index();
$table->foreignIdFor(app('escaperoom_theme'))->index();
$table->timestamps();
});
}
Expand Down
46 changes: 0 additions & 46 deletions src/EscapeRoomServiceProvider.php

This file was deleted.

Loading

0 comments on commit 7486fbc

Please sign in to comment.