TESTING #1931: do something with tests.. Not really usefull
This commit is contained in:
@@ -28,10 +28,13 @@ $factory->define(User::class, function (Faker\Generator $faker) {
|
||||
});
|
||||
|
||||
$factory->define(Content::class, function (Faker\Generator $faker) {
|
||||
|
||||
$slug = isset($faker->slug) ? $faker->slug : $faker->slug(5);
|
||||
|
||||
return [
|
||||
'title' => $faker->sentence(5),
|
||||
'userId' => 1,
|
||||
'url' => $faker->slug(5),
|
||||
'url' => $slug,
|
||||
'pageContent' => $faker->text(1500),
|
||||
'metaDescription' => $faker->text,
|
||||
'moduleHandler' => config('staticpages.handler'),
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
stopOnFailure="false">
|
||||
<testsuites>
|
||||
<testsuite name="unit">
|
||||
<directory>./tests/unit/</directory>
|
||||
<directory>./tests/Unit/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace Tests\Unit\Admin\Content;
|
||||
namespace Tests\Unit\Content;
|
||||
|
||||
use App\CMS\Contracts\Repositories\Content;
|
||||
use App\Models\Content\Content as ContentModel;
|
||||
+23
-39
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace Tests\Unit\Admin\Content;
|
||||
|
||||
namespace Tests\Unit\Content;
|
||||
|
||||
use App\CMS\Contracts\Repositories\Content;
|
||||
use App\Models\Content\Content as ContentModel;
|
||||
@@ -41,7 +42,6 @@ class RepositoryTest extends TestCase
|
||||
|
||||
/**
|
||||
* Test for selecting homepage.
|
||||
*
|
||||
* At first, it tries to select non-existing homepage. On second try, homepage is created.
|
||||
*/
|
||||
public function testSelectingHomepage()
|
||||
@@ -65,44 +65,28 @@ class RepositoryTest extends TestCase
|
||||
public function testSelectingAllPages()
|
||||
{
|
||||
$all = $this->content->all();
|
||||
|
||||
$this->assertCount(6, $all);
|
||||
}
|
||||
|
||||
// public function testContentVisibilityByPublishedFrom()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public function testContentVisibilityByPublishedTo()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public function testSelectingByURL()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public function testSelectingById()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public function testSelectingInvalidPageByURL()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public function testSelectingInvalidPageById()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public function testOverview()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public function testOvervieWithOneStatus()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public function testOverviewWithMultipleStatuses()
|
||||
// {
|
||||
// }
|
||||
public function testSelectingByURL()
|
||||
{
|
||||
$slug = 'testing-slug-for-testing-purposes';
|
||||
factory(ContentModel::class, 3)->create([
|
||||
'userId' => $this->user->id,
|
||||
'status' => Content::STATUS_PUBLIC,
|
||||
'url' => $slug
|
||||
]);
|
||||
|
||||
$page = $this->content->getByURL($slug);
|
||||
|
||||
$this->assertNotNull($page);
|
||||
$this->assertTrue($page->exists);
|
||||
}
|
||||
|
||||
public function testSelectingInvalidPageByURL()
|
||||
{
|
||||
$invalidPage = $this->content->getByURL('non-existing-url');
|
||||
|
||||
$this->assertNull($invalidPage);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user