Browse Source

Update proper tests assertion after generated form view changes

tags/1.0.0
Nafies Luthfi 8 years ago
parent
commit
e8b6d95ab8
  1. 16
      tests/CrudMakeCommandTest.php
  2. 6
      tests/CrudSimpleMakeCommandTest.php
  3. 2
      tests/Generators/FullControllerGeneratorTest.php
  4. 2
      tests/Generators/Simple/SimpleControllerGeneratorTest.php
  5. 2
      tests/TestCase.php

16
tests/CrudMakeCommandTest.php

@ -20,7 +20,9 @@ class CrudMakeCommandTest extends TestCase
$this->assertFileExists($migrationFilePath);
$this->assertFileExists(resource_path("views/{$this->table_name}/index.blade.php"));
$this->assertFileExists(resource_path("views/{$this->table_name}/forms.blade.php"));
$this->assertFileExists(resource_path("views/{$this->table_name}/create.blade.php"));
$this->assertFileExists(resource_path("views/{$this->table_name}/edit.blade.php"));
$this->assertFileNotExists(resource_path("views/{$this->table_name}/forms.blade.php"));
$localeConfig = config('app.locale');
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$this->lang_name}.php"));
@ -47,6 +49,8 @@ class CrudMakeCommandTest extends TestCase
$this->assertFileNotExists($migrationFilePath);
$this->assertFileNotExists(resource_path("views/{$this->table_name}/index.blade.php"));
$this->assertFileNotExists(resource_path("views/{$this->table_name}/create.blade.php"));
$this->assertFileNotExists(resource_path("views/{$this->table_name}/edit.blade.php"));
$this->assertFileNotExists(resource_path("views/{$this->table_name}/forms.blade.php"));
$localeConfig = config('app.locale');
@ -74,6 +78,8 @@ class CrudMakeCommandTest extends TestCase
$this->assertFileNotExists($migrationFilePath);
$this->assertFileNotExists(resource_path("views/problems/index.blade.php"));
$this->assertFileNotExists(resource_path("views/problems/create.blade.php"));
$this->assertFileNotExists(resource_path("views/problems/edit.blade.php"));
$this->assertFileNotExists(resource_path("views/problems/forms.blade.php"));
$localeConfig = config('app.locale');
@ -110,7 +116,9 @@ class CrudMakeCommandTest extends TestCase
$this->assertFileExists($migrationFilePath);
$this->assertFileExists(resource_path("views/{$tableName}/index.blade.php"));
$this->assertFileExists(resource_path("views/{$tableName}/forms.blade.php"));
$this->assertFileExists(resource_path("views/{$tableName}/create.blade.php"));
$this->assertFileExists(resource_path("views/{$tableName}/edit.blade.php"));
$this->assertFileNotExists(resource_path("views/{$tableName}/forms.blade.php"));
$localeConfig = config('app.locale');
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$langName}.php"));
@ -143,7 +151,9 @@ class CrudMakeCommandTest extends TestCase
$this->assertFileExists($migrationFilePath);
$this->assertFileExists(resource_path("views/{$tableName}/index.blade.php"));
$this->assertFileExists(resource_path("views/{$tableName}/forms.blade.php"));
$this->assertFileExists(resource_path("views/{$tableName}/create.blade.php"));
$this->assertFileExists(resource_path("views/{$tableName}/edit.blade.php"));
$this->assertFileNotExists(resource_path("views/{$tableName}/forms.blade.php"));
$localeConfig = config('app.locale');
$this->assertFileExists(resource_path("lang/{$localeConfig}/{$langName}.php"));

6
tests/CrudSimpleMakeCommandTest.php

@ -63,7 +63,7 @@ class CrudSimpleCommandTest extends TestCase
public function it_cannot_generate_crud_files_if_namespaced_model_exists()
{
$this->artisan('make:model', ['name' => 'Entities/Projects/Problem', '--no-interaction' => true]);
$this->artisan('make:crud', ['name' => 'Entities/Projects/Problem', '--no-interaction' => true]);
$this->artisan('make:crud-simple', ['name' => 'Entities/Projects/Problem', '--no-interaction' => true]);
$this->assertContains("Problem model already exists.", app(Kernel::class)->output());
@ -99,7 +99,7 @@ class CrudSimpleCommandTest extends TestCase
$langName = 'category';
$modelPath = 'Entities/References';
$this->artisan('make:crud', ['name' => $inputName, '--no-interaction' => true]);
$this->artisan('make:crud-simple', ['name' => $inputName, '--no-interaction' => true]);
$this->assertNotContains("{$modelName} model already exists.", app(Kernel::class)->output());
@ -132,7 +132,7 @@ class CrudSimpleCommandTest extends TestCase
$langName = 'category';
$modelPath = 'Entities/References';
$this->artisan('make:crud', ['name' => $inputName, '--parent' => $parentName, '--no-interaction' => true]);
$this->artisan('make:crud-simple', ['name' => $inputName, '--parent' => $parentName, '--no-interaction' => true]);
$this->assertNotContains("{$modelName} model already exists.", app(Kernel::class)->output());

2
tests/Generators/ControllerGeneratorTest.php → tests/Generators/FullControllerGeneratorTest.php

@ -4,7 +4,7 @@ namespace Tests\Generators;
use Tests\TestCase;
class ControllerGeneratorTest extends TestCase
class FullControllerGeneratorTest extends TestCase
{
/** @test */
public function it_creates_correct_controller_class_content()

2
tests/Generators/Simple/ControllerGeneratorTest.php → tests/Generators/Simple/SimpleControllerGeneratorTest.php

@ -4,7 +4,7 @@ namespace Tests\Generators\Simple;
use Tests\TestCase;
class ControllerGeneratorTest extends TestCase
class SimpleControllerGeneratorTest extends TestCase
{
/** @test */
public function it_creates_correct_controller_class_content()

2
tests/TestCase.php

@ -41,6 +41,7 @@ abstract class TestCase extends BaseTestCase
$this->removeFileOrDir(app_path('Http'));
$this->removeFileOrDir(database_path('migrations'));
$this->removeFileOrDir(database_path('factories'));
$this->removeFileOrDir(resource_path('views/categories'));
$this->removeFileOrDir(resource_path('views/'.$this->table_name));
$defaultLayoutsFile = config('simple-crud.default_layout_view');
@ -54,6 +55,7 @@ abstract class TestCase extends BaseTestCase
$locale = config('app.locale');
$this->removeFileOrDir(resource_path("lang/{$locale}/app.php"));
$this->removeFileOrDir(resource_path("lang/{$locale}/{$this->lang_name}.php"));
$this->removeFileOrDir(resource_path("lang/{$locale}/category.php"));
$this->removeFileOrDir(base_path('routes'));
$this->removeFileOrDir(app_path('Policies'));

Loading…
Cancel
Save