Permalink
Browse files

Reorgansing

  • Loading branch information...
REBELinBLUE committed Feb 15, 2017
1 parent 8922490 commit 64c8614f2fded2387ec7631624de91d53db5434c
View
@@ -6,6 +6,8 @@
.php_cs.cache
.php_cs
phpunit.xml
phpcs.xml
phpmd.xml
_ide_helper.php
_ide_helper_models.php
.phpstorm.meta.php
View
@@ -62,7 +62,7 @@ permissions:
## PHP Coding Standards (PSR-2)
phpcs:
@echo "\033[32mPHP Code Sniffer\033[39m"
@php vendor/bin/phpcs --standard=phpcs.xml
@php vendor/bin/phpcs
## PHPDoc Checker
phpdoc-check:
@@ -72,7 +72,8 @@ phpdoc-check:
## PHP Mess Detector
phpmd:
@echo "\033[32mPHP Mess Detector\033[39m"
@php vendor/bin/phpmd app text phpmd.xml
@if [ -f phpmd.xml ]; then php vendor/bin/phpmd app text phpmd.xml; fi
@if [ ! -f phpmd.xml ]; then php vendor/bin/phpmd app text phpmd.xml.dist; fi
## PHP Copy/Paste Detector
phpcpd:
@@ -87,7 +88,7 @@ dusk:
## Test Coverage
coverage:
@echo "\033[32mAll tests with coverage\033[39m"
@php vendor/bin/phpunit --coverage-clover=coverage.xml --coverage-text=/dev/null
@php vendor/bin/phpunit --coverage-html=storage/app/tmp/coverage/
## Unit Tests - Excluding slow model tests which touch the database
phpunit-fast:
@@ -173,17 +174,18 @@ endif
# Run the PHPUnit tests for Travis CI
phpunit-ci:
ifeq "$(TRAVIS_PHP_VERSION)" "7.0"
@echo "\033[32mUnit Tests with coverage\033[39m"
@php vendor/bin/phpunit --coverage-php=storage/tmp/coverage/ --coverage-clover=/dev/null \
--coverage-text=/dev/null --testsuite "Unit Tests" --exclude-group slow
@echo "\033[32mSlow Unit Tests with coverage\033[39m"
@php vendor/bin/phpunit --coverage-php=storage/tmp/coverage/ --coverage-clover=/dev/null \
--coverage-text=/dev/null --testsuite "Unit Tests" --exclude-group default
@echo "\033[32mIntegration Tests with coverage\033[39m"
@php vendor/bin/phpunit --coverage-php=storage/tmp/coverage/ --coverage-clover=/dev/null \
--coverage-text=/dev/null --testsuite "Integration Tests"
@echo "\033[32mMerging coverage\033[39m"
@php vendor/bin/phpcov merge storage/tmp/coverage/ --clover coverage.xml
# @mkdir tmp/
# @echo "\033[32mUnit Tests with coverage\033[39m"
# @php vendor/bin/phpunit --coverage-php=tmp/ --testsuite "Unit Tests" --exclude-group slow
# @echo "\033[32mSlow Unit Tests with coverage\033[39m"
# @php vendor/bin/phpunit --coverage-php=tmp/ --testsuite "Unit Tests" --exclude-group default
# @echo "\033[32mIntegration Tests with coverage\033[39m"
# @php vendor/bin/phpunit --coverage-php=stmp/ --testsuite "Integration Tests"
# @echo "\033[32mMerging coverage\033[39m"
# @php vendor/bin/phpcov merge tmp/ --clover coverage.xml
# @rm -rf tmp/
@echo "\033[32mAll Tests with coverage\033[39m"
@php vendor/bin/phpunit --coverage-clover=coverage.xml
else ifeq "$(DB)" "sqlite"
@$(MAKE) phpunit
@$(MAKE) integration
@@ -30,10 +30,10 @@ public function rules()
// On edit we don't require the step or the project_id
if ($this->route('command')) {
unset($rules['step']);
unset($rules['target_id']);
unset($rules['target_type']);
}
// FIXME: Unset target_type/target_id
return $rules;
}
}
@@ -5,8 +5,6 @@
use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
use Clockwork\Support\Laravel\ClockworkMiddleware;
use Clockwork\Support\Laravel\ClockworkServiceProvider;
use Faker\Factory as FakerFactory;
use Faker\Generator as FakerGenerator;
use GrahamCampbell\HTMLMin\HTMLMinServiceProvider;
use GrahamCampbell\HTMLMin\Http\Middleware\MinifyMiddleware;
use Illuminate\Database\Eloquent\Relations\Relation;
View
@@ -77,7 +77,7 @@
|
*/
'locale' => env('APP_LOCALE', 'en'),
'locale' => env('APP_LOCALE', 'en'),
'faker_locale' => 'en_GB',
/*
File renamed without changes.
File renamed without changes.
View
@@ -29,13 +29,10 @@
<directory suffix=".php">./app/</directory>
<exclude>
<directory suffix=".php">./app/Helpers</directory>
<directory suffix=".php">./routes</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-text" target="php://stdout" lowUpperBound="50" highLowerBound="80" />
<log type="coverage-clover" target="coverage.xml" />
</logging>
<php>
<env name="APP_ENV" value="testing" />
<env name="APP_URL" value="http://localhost" />
@@ -42,9 +42,10 @@ public function testStore()
{
$expected = 'a-new-group';
$response = $this->postJson('/admin/groups', ['name' => $expected]);
$this->postJson('/admin/groups', ['name' => $expected])
->assertStatus(Response::HTTP_CREATED)
->assertJson(['name' => $expected]);
$response->assertStatus(Response::HTTP_CREATED)->assertJson(['name' => $expected]);
$this->assertDatabaseHas('groups', ['name' => $expected]);
}
@@ -56,9 +57,9 @@ public function testStore()
*/
public function testStoreValidatesNameRequired()
{
$response = $this->postJson('/admin/groups', ['foo' => 'bar', 'name' => '']);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)->assertJsonStructure(['name']);
$this->postJson('/admin/groups', ['foo' => 'bar', 'name' => ''])
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonStructure(['name']);
}
/**
@@ -71,9 +72,9 @@ public function testStoreValidatesNameUnique()
{
factory(Group::class)->create(['name' => 'Foo']);
$response = $this->postJson('/admin/groups', ['name' => 'Foo']);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)->assertJsonStructure(['name']);
$this->postJson('/admin/groups', ['name' => 'Foo'])
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonStructure(['name']);
}
/**
@@ -86,9 +87,10 @@ public function testUpdate()
{
factory(Group::class)->create(['name' => 'Foo']);
$response = $this->putJson('/admin/groups/2', ['name' => 'Bar']);
$this->putJson('/admin/groups/2', ['name' => 'Bar'])
->assertStatus(Response::HTTP_OK)
->assertJson(['id' => 2, 'name' => 'Bar']);
$response->assertStatus(Response::HTTP_OK)->assertJson(['id' => 2, 'name' => 'Bar']);
$this->assertDatabaseHas('groups', ['id' => 2, 'name' => 'Bar']);
$this->assertDatabaseMissing('groups', ['name' => 'Foo']);
}
@@ -99,9 +101,7 @@ public function testUpdate()
*/
public function testUpdateReturnsErrorWhenInvalid()
{
$response = $this->putJson('/admin/groups/1000', ['name' => 'Bar']);
$response->assertStatus(Response::HTTP_NOT_FOUND);
$this->putJson('/admin/groups/1000', ['name' => 'Bar'])->assertStatus(Response::HTTP_NOT_FOUND);
}
/**
@@ -114,9 +114,10 @@ public function testUpdateDoesNotErrorIfNameIsNotChanged()
{
factory(Group::class)->create(['name' => 'Foo']);
$response = $this->putJson('/admin/groups/2', ['name' => 'Foo']);
$this->putJson('/admin/groups/2', ['name' => 'Foo'])
->assertStatus(Response::HTTP_OK)
->assertJson(['id' => 2, 'name' => 'Foo']);
$response->assertStatus(Response::HTTP_OK)->assertJson(['id' => 2, 'name' => 'Foo']);
$this->assertDatabaseHas('groups', ['id' => 2, 'name' => 'Foo']);
}
@@ -130,9 +131,9 @@ public function testUpdateValidateNameRequired()
{
factory(Group::class)->create(['name' => 'Foo']);
$response = $this->putJson('/admin/groups/2', ['foo' => 'bar', 'name' => '']);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)->assertJsonStructure(['name']);
$this->putJson('/admin/groups/2', ['foo' => 'bar', 'name' => ''])
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonStructure(['name']);
}
/**
@@ -146,9 +147,9 @@ public function testUpdateValidatesNameUnique()
factory(Group::class)->create(['name' => 'Foo']);
factory(Group::class)->create(['name' => 'Bar']);
$response = $this->putJson('/admin/groups/2', ['name' => 'Bar']);
$response->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)->assertJsonStructure(['name']);
$this->putJson('/admin/groups/2', ['name' => 'Bar'])
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonStructure(['name']);
}
/**
@@ -160,9 +161,10 @@ public function testReorder()
factory(Group::class)->create(['name' => 'Foo', 'order' => 2]);
factory(Group::class)->create(['name' => 'Bar', 'order' => 1]);
$response = $this->post('/admin/groups/reorder', ['groups' => [3, 1, 2]]);
$this->post('/admin/groups/reorder', ['groups' => [3, 1, 2]])
->assertStatus(Response::HTTP_OK)
->assertExactJson(['success' => true]);
$response->assertStatus(Response::HTTP_OK)->assertExactJson(['success' => true]);
$this->assertDatabaseHas('groups', ['id' => 3, 'name' => 'Bar', 'order' => 0]);
$this->assertDatabaseHas('groups', ['id' => 1, 'name' => 'Projects', 'order' => 1]);
$this->assertDatabaseHas('groups', ['id' => 2, 'name' => 'Foo', 'order' => 2]);
@@ -65,9 +65,8 @@ public function testStore()
'id' => 1,
], array_except($input, ['template_id']));
$response = $this->postJson('/admin/projects', $input);
$this->postJson('/admin/projects', $input)->assertStatus(Response::HTTP_CREATED)->assertJson($output);
$response->assertStatus(Response::HTTP_CREATED)->assertJson($output);
$this->assertDatabaseHas('projects', $output);
}
@@ -105,9 +104,8 @@ public function testUpdate()
'name' => $updated,
]);
$response = $this->putJson('/admin/projects/1', $input);
$this->putJson('/admin/projects/1', $input)->assertStatus(Response::HTTP_OK)->assertJson($input);
$response->assertStatus(Response::HTTP_OK)->assertJson($input);
$this->assertDatabaseHas('projects', ['name' => $updated]);
$this->assertDatabaseMissing('projects', ['name' => $original]);
}
@@ -130,9 +128,7 @@ public function testUpdateReturnsErrorWhenInvalid()
'include_dev' => false,
];
$response = $this->putJson('/admin/projects/1000', $input);
$response->assertStatus(Response::HTTP_NOT_FOUND);
$this->putJson('/admin/projects/1000', $input)->assertStatus(Response::HTTP_NOT_FOUND);
}
/**
@@ -144,9 +140,7 @@ public function testDelete()
factory(Project::class)->create(['name' => $name]);
$response = $this->deleteJson('/admin/projects/1');
$response->assertStatus(Response::HTTP_NO_CONTENT);
$this->deleteJson('/admin/projects/1')->assertStatus(Response::HTTP_NO_CONTENT);
$this->assertDatabaseMissing('projects', ['name' => $name, 'deleted_at' => null]);
}
@@ -156,8 +150,6 @@ public function testDelete()
*/
public function testDeleteReturnsErrorWhenInvalid()
{
$response = $this->deleteJson('/admin/projects/1000');
$response->assertStatus(Response::HTTP_NOT_FOUND);
$this->deleteJson('/admin/projects/1000')->assertStatus(Response::HTTP_NOT_FOUND);
}
}
@@ -24,9 +24,10 @@ public function testStore()
{
$expected = 'a-new-template';
$response = $this->postJson('/admin/templates', ['name' => $expected]);
$this->postJson('/admin/templates', ['name' => $expected])
->assertStatus(Response::HTTP_CREATED)
->assertJson(['name' => $expected]);
$response->assertStatus(Response::HTTP_CREATED)->assertJson(['name' => $expected]);
$this->assertDatabaseHas('templates', ['name' => $expected]);
}
@@ -40,9 +41,10 @@ public function testUpdate()
{
factory(Template::class)->create(['name' => 'Foo']);
$response = $this->putJson('/admin/templates/1', ['name' => 'Bar']);
$this->putJson('/admin/templates/1', ['name' => 'Bar'])
->assertStatus(Response::HTTP_OK)
->assertJson(['id' => 1, 'name' => 'Bar']);
$response->assertStatus(Response::HTTP_OK)->assertJson(['id' => 1, 'name' => 'Bar']);
$this->assertDatabaseHas('templates', ['id' => 1, 'name' => 'Bar']);
$this->assertDatabaseMissing('templates', ['name' => 'Foo']);
}
@@ -53,9 +55,7 @@ public function testUpdate()
*/
public function testUpdateReturnsErrorWhenInvalid()
{
$response = $this->putJson('/admin/templates/1000', ['name' => 'Bar']);
$response->assertStatus(Response::HTTP_NOT_FOUND);
$this->putJson('/admin/templates/1000', ['name' => 'Bar'])->assertStatus(Response::HTTP_NOT_FOUND);
}
/**
@@ -69,9 +69,7 @@ public function testDelete()
factory(Template::class)->create(['name' => $name]);
$response = $this->deleteJson('/admin/templates/1');
$response->assertStatus(Response::HTTP_NO_CONTENT);
$this->deleteJson('/admin/templates/1')->assertStatus(Response::HTTP_NO_CONTENT);
$this->assertDatabaseMissing('templates', ['name' => $name, 'deleted_at' => null]);
}
@@ -81,8 +79,6 @@ public function testDelete()
*/
public function testDeleteReturnsErrorWhenInvalid()
{
$response = $this->deleteJson('/admin/templates/1000');
$response->assertStatus(Response::HTTP_NOT_FOUND);
$this->deleteJson('/admin/templates/1000')->assertStatus(Response::HTTP_NOT_FOUND);
}
}
Oops, something went wrong.

0 comments on commit 64c8614

Please sign in to comment.