Add test for sensitivity component partial overrides

Refs #1854
Laravel looks like it broke ->contains($model), fix test for now
This commit is contained in:
Samuel Georges 2017-06-27 05:05:24 +10:00
parent 8a9355ca66
commit 6aa60305a0
6 changed files with 40 additions and 6 deletions

View File

@ -0,0 +1,5 @@
url = "/component-partial-alias-override"
[October\Tester\Components\Post overRide1]
==
{% component 'overRide1' %}

View File

@ -1,5 +1,5 @@
url = "/component-partial-override"
[October\Tester\Components\Post override1]
[testPost]
==
{% component 'override1' %}
{% component 'testPost' %}

View File

@ -1 +1 @@
<p>I am an override partial! Yay</p>
<p>I am an override alias partial! Yay</p>

View File

@ -0,0 +1 @@
<p>I am an override partial! Yay</p>

View File

@ -12,6 +12,13 @@ class ControllerTest extends TestCase
Model::clearBootedModels();
Model::flushEventListeners();
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/Archive.php';
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/Post.php';
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/MainMenu.php';
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/ContentBlock.php';
include_once base_path() . '/tests/fixtures/plugins/october/tester/components/Comments.php';
include_once base_path() . '/tests/fixtures/plugins/october/tester/classes/Users.php';
}
public function testThemeUrl()
@ -395,12 +402,33 @@ ESC;
$this->assertEquals('<p>DEFAULT MARKUP: I am a post yay</p>', $response);
}
public function testComponentPartialAliasOverride()
{
$theme = Theme::load('test');
$controller = new Controller($theme);
$response = $controller->run('/component-partial-alias-override')->getContent();
//
// Testing case sensitivity
//
// Component alias: overRide1
// Target path: partials\override1\default.htm
//
$this->assertEquals('<p>I am an override alias partial! Yay</p>', $response);
}
public function testComponentPartialOverride()
{
$theme = Theme::load('test');
$controller = new Controller($theme);
$response = $controller->run('/component-partial-override')->getContent();
//
// Testing case sensitivity
//
// Component code: testPost
// Target path: partials\testpost\default.htm
//
$this->assertEquals('<p>I am an override partial! Yay</p>', $response);
}

View File

@ -25,11 +25,11 @@ class BelongsToManyModelTest extends PluginTestCase
Model::reguard();
// Add/remove to collection
$this->assertFalse($author->roles->contains($role1));
$this->assertFalse($author->roles->contains($role1->id));
$author->roles()->add($role1);
$author->roles()->add($role2);
$this->assertTrue($author->roles->contains($role1));
$this->assertTrue($author->roles->contains($role2));
$this->assertTrue($author->roles->contains($role1->id));
$this->assertTrue($author->roles->contains($role2->id));
// Set by Model object
$author->roles = $role1;