Skip to content

Commit

Permalink
removed aliases and require from module.json stub
Browse files Browse the repository at this point in the history
  • Loading branch information
dcblogdev committed Aug 31, 2022
1 parent 65827ca commit c7c2559
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 119 deletions.
4 changes: 1 addition & 3 deletions src/Commands/stubs/json.stub
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@
"providers": [
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\$PROVIDER_NAMESPACE$\\$STUDLY_NAME$ServiceProvider"
],
"aliases": {},
"files": [],
"requires": []
"files": []
}
16 changes: 0 additions & 16 deletions src/Contracts/RepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,6 @@ public function getByStatus($status);
*/
public function find(string $name);

/**
* Find all modules that are required by a module. If the module cannot be found, throw an exception.
*
* @param $name
* @return array
* @throws ModuleNotFoundException
*/
public function findRequirements($name): array;

/**
* Find a specific module. If there return that, otherwise throw exception.
*
Expand Down Expand Up @@ -128,13 +119,6 @@ public function config(string $key, $default = null);
*/
public function getPath(): string;

/**
* Find a specific module by its alias.
* @param string $alias
* @return Module|void
*/
public function findByAlias(string $alias);

/**
* Boot the modules.
*/
Expand Down
30 changes: 0 additions & 30 deletions src/FileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,36 +346,6 @@ public function find(string $name)
return;
}

/**
* @inheritDoc
*/
public function findByAlias(string $alias)
{
foreach ($this->all() as $module) {
if ($module->getAlias() === $alias) {
return $module;
}
}

return;
}

/**
* @inheritDoc
*/
public function findRequirements($name): array
{
$requirements = [];

$module = $this->findOrFail($name);

foreach ($module->getRequires() as $requirementName) {
$requirements[] = $this->findByAlias($requirementName);
}

return $requirements;
}

/**
* Find a specific module, if there return that, otherwise throw exception.
*
Expand Down
20 changes: 0 additions & 20 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,6 @@ public function getDescription(): string
return $this->get('description');
}

/**
* Get alias.
*
* @return string
*/
public function getAlias(): string
{
return $this->get('alias');
}

/**
* Get priority.
*
Expand All @@ -144,16 +134,6 @@ public function getPriority(): string
return $this->get('priority');
}

/**
* Get module requirements.
*
* @return array
*/
public function getRequires(): array
{
return $this->get('requires');
}

/**
* Get path.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@
"providers": [
"Modules\\Blog\\Providers\\BlogServiceProvider"
],
"aliases": {},
"files": [],
"requires": []
"files": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@
"providers": [
"Modules\\Blog\\Base\\Providers\\BlogServiceProvider"
],
"aliases": {},
"files": [],
"requires": []
"files": []
}
20 changes: 0 additions & 20 deletions tests/LaravelFileRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ public function it_finds_a_module()
$this->assertInstanceOf(Module::class, $this->repository->find('recipe'));
}

/** @test */
public function it_finds_a_module_by_alias()
{
$this->repository->addLocation(__DIR__ . '/stubs/valid');

$this->assertInstanceOf(Module::class, $this->repository->findByAlias('recipe'));
$this->assertInstanceOf(Module::class, $this->repository->findByAlias('required_module'));
}

/** @test */
public function it_find_or_fail_throws_exception_if_module_not_found()
{
Expand Down Expand Up @@ -233,17 +224,6 @@ public function it_can_delete_a_module()
$this->assertFalse(is_dir(base_path('modules/Blog')));
}

/** @test */
public function it_can_find_all_requirements_of_a_module()
{
$this->repository->addLocation(__DIR__ . '/stubs/valid');

$requirements = $this->repository->findRequirements('Recipe');

$this->assertCount(1, $requirements);
$this->assertInstanceOf(Module::class, $requirements[0]);
}

/** @test */
public function it_can_register_macros()
{
Expand Down
12 changes: 0 additions & 12 deletions tests/LaravelModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ public function it_gets_module_description()
$this->assertEquals('recipe module', $this->module->getDescription());
}

/** @test */
public function it_gets_module_alias()
{
$this->assertEquals('recipe', $this->module->getAlias());
}

/** @test */
public function it_gets_module_path()
{
Expand All @@ -99,12 +93,6 @@ public function it_gets_module_path_with_symlink()
// symlink deleted in tearDownAfterClass
}

/** @test */
public function it_gets_required_modules()
{
$this->assertEquals(['required_module'], $this->module->getRequires());
}

/** @test */
public function it_loads_module_translations()
{
Expand Down
12 changes: 0 additions & 12 deletions tests/LumenModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,12 @@ public function it_gets_module_description()
$this->assertEquals('recipe module', $this->module->getDescription());
}

/** @test */
public function it_gets_module_alias()
{
$this->assertEquals('recipe', $this->module->getAlias());
}

/** @test */
public function it_gets_module_path()
{
$this->assertEquals(__DIR__ . '/stubs/valid/Recipe', $this->module->getPath());
}

/** @test */
public function it_gets_required_modules()
{
$this->assertEquals(['required_module'], $this->module->getRequires());
}

/** @test */
public function it_loads_module_translations()
{
Expand Down

0 comments on commit c7c2559

Please sign in to comment.