Skip to content

Commit

Permalink
Merge pull request #18 from samrap/dev
Browse files Browse the repository at this point in the history
Fix #17
  • Loading branch information
Sam Rapaport authored Apr 27, 2017
2 parents 98c30f0 + 079fb3c commit 1f787c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

2 changes: 2 additions & 0 deletions src/Fluent/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ public function escape($func = 'esc_html')
public function shortcodes()
{
$this->shortcodes = true;

return $this;
}

/*
Expand Down
39 changes: 14 additions & 25 deletions tests/Unit/Fluent/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ public function setExpect()
{
$builder = new Builder(new RunnerMock);

$builder->expect('string');
$return = $builder->expect('string');

$this->assertSame($builder, $return);
$this->assertEquals('string', $builder->expect);
}

Expand All @@ -36,8 +37,9 @@ public function setDefault()
{
$builder = new Builder(new RunnerMock);

$builder->default('bar');
$return = $builder->default('bar');

$this->assertSame($builder, $return);
$this->assertEquals('bar', $builder->default);
}

Expand All @@ -46,8 +48,9 @@ public function setEscape()
{
$builder = new Builder(new RunnerMock);

$builder->escape();
$return = $builder->escape();

$this->assertSame($builder, $return);
$this->assertEquals('esc_html', $builder->escape);
}

Expand All @@ -56,8 +59,9 @@ public function setEscapeAllowsCustomFunction()
{
$builder = new Builder(new RunnerMock);

$builder->escape('htmlentities');
$return = $builder->escape('htmlentities');

$this->assertSame($builder, $return);
$this->assertEquals('htmlentities', $builder->escape);
}

Expand All @@ -66,8 +70,9 @@ public function setId()
{
$builder = new Builder(new RunnerMock);

$builder->id(2);
$return = $builder->id(2);

$this->assertSame($builder, $return);
$this->assertEquals(2, $builder->id);
}

Expand All @@ -76,8 +81,9 @@ public function setShortcodes()
{
$builder = new Builder(new RunnerMock);

$builder->shortcodes();
$return = $builder->shortcodes();

$this->assertSame($builder, $return);
$this->assertTrue($builder->shortcodes);
}

Expand All @@ -86,29 +92,12 @@ public function setRaw()
{
$builder = new Builder(new RunnerMock);

$builder->raw();
$return = $builder->raw();

$this->assertSame($builder, $return);
$this->assertTrue($builder->raw);
}

/** @test */
public function fluentBuilder()
{
$builder = new Builder(new RunnerMock);

$builder
->field('foo')
->id(2)
->expect('string')
->default('bar')
->escape();

$this->assertEquals('foo', $builder->field);
$this->assertEquals('string', $builder->expect);
$this->assertEquals('bar', $builder->default);
$this->assertEquals('esc_html', $builder->escape);
}

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

0 comments on commit 1f787c9

Please sign in to comment.