Skip to content

Commit

Permalink
CS fix in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzap committed Feb 22, 2016
1 parent a106c2b commit d2b8280
Show file tree
Hide file tree
Showing 35 changed files with 25 additions and 64 deletions.
2 changes: 1 addition & 1 deletion tests/_files/foo/alias.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?= $T->foo ?>
<?= $T->foo;
10 changes: 2 additions & 8 deletions tests/_files/stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class Value
{

public $value;

public function __construct($value)
Expand All @@ -15,25 +14,22 @@ public function __construct($value)

class ToArray extends Value
{

public function toArray()
{
return ['toarray' => (array)$this->value];
return ['toarray' => (array) $this->value];
}
}

class AsArray extends Value
{

public function asArray()
{
return ['asarray' => (array)$this->value];
return ['asarray' => (array) $this->value];
}
}

class Json implements JsonSerializable
{

public function jsonSerialize()
{
return '<b>I am JSON</b>';
Expand All @@ -42,12 +38,10 @@ public function jsonSerialize()

class Target extends Value
{

}

class Transformer
{

public function transform($object)
{
return is_object($object) ? ['transformed' => get_object_vars($object)] : false;
Expand Down
2 changes: 1 addition & 1 deletion tests/boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

$vendor = dirname(dirname(__FILE__)).'/vendor/';

if ( ! realpath($vendor)) {
if (! realpath($vendor)) {
die('Please install via Composer before running tests.');
}

Expand Down
3 changes: 1 addition & 2 deletions tests/src/Functional/AdvRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
class AdvRenderTest extends TestCaseFunctional
{

private $templates_path;

public function setUp()
Expand Down Expand Up @@ -103,7 +102,7 @@ private function provideRegexContext()
$context_failed = new RegexContext('/[0-9]+/', ['i_do_not_exist' => 'NOT SHOULD BE HERE']);
$this->engine->useContext($context);
$this->engine->useContext($context_failed);
$this->engine->useContext('/\.php$/', ['title' => 'Foil is Awesome!',], true);
$this->engine->useContext('/\.php$/', ['title' => 'Foil is Awesome!', ], true);
}

/**
Expand Down
1 change: 0 additions & 1 deletion tests/src/Functional/BlocksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
class BlocksTest extends TestCaseFunctional
{

/**
* @coversNothing
*/
Expand Down
1 change: 0 additions & 1 deletion tests/src/Functional/EngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
class EngineTest extends TestCaseFunctional
{

public function setUp()
{
parent::setUp();
Expand Down
1 change: 0 additions & 1 deletion tests/src/Functional/SimpleRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class SimpleRenderTest extends TestCaseFunctional
{

/**
* @coversNothing
*/
Expand Down
7 changes: 3 additions & 4 deletions tests/src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
class TestCase extends PHPUnit_Framework_TestCase
{

protected function setUp()
{
parent::setUp();
Expand Down Expand Up @@ -57,14 +56,14 @@ protected function bindClosure(Closure $closure, $object, array $args = [])
*/
protected function accessPrivateProperty($property, $object)
{
if ( ! is_string($property) || ! is_object($object)) {
if (! is_string($property) || ! is_object($object)) {
throw new InvalidArgumentException(
__METHOD__.' needs a valid property name and a valid object.'
);
}

return $this->bindClosure(function ($property) {
if ( ! isset($this->$property)) {
if (! isset($this->$property)) {
throw new LogicException(
"{$property} is not a set on the object."
);
Expand All @@ -82,7 +81,7 @@ protected function accessPrivateProperty($property, $object)
*/
protected function setPrivateProperty($property, $value, $object)
{
if ( ! is_string($property) || ! is_object($object)) {
if (! is_string($property) || ! is_object($object)) {
throw new InvalidArgumentException(
__METHOD__.' needs a valid property name and a valid object.'
);
Expand Down
1 change: 0 additions & 1 deletion tests/src/TestCaseFunctional.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
class TestCaseFunctional extends TestCase
{

/**
* @var \Foil\Engine
*/
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Blocks/BlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
class BlockTest extends TestCase
{

public function testOpen()
{
$block = new Block('strtoupper');
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Blocks/BlocksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
class BlocksTest extends TestCase
{

/**
* @expectedException \InvalidArgumentException
*/
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Blocks/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
class FactoryTest extends TestCase
{

public function testFactory()
{
$factory = new Factory();
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Context/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
class CollectionTest extends TestCase
{

/**
* @return \Foil\Context\Collection
*/
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Context/GlobalContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class GlobalContextTest extends TestCase
{

public function testAccept()
{
$c = new GlobalContext(['foo' => 'bar']);
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Context/RegexContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
class RegexContextTest extends TestCase
{

/**
* @expectedException \InvalidArgumentException
*/
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Context/SearchContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class SearchContextTest extends TestCase
{

/**
* @expectedException \InvalidArgumentException
*/
Expand Down
3 changes: 1 addition & 2 deletions tests/src/Unit/EngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
class EngineTest extends TestCase
{

/**
* @param \Foil\Kernel\Events $events
* @param \Foil\Template\Finder $finder
Expand All @@ -36,7 +35,7 @@ private function getEngine(Events $events = null, Finder $finder = null, $render
$stack = Mockery::mock('Foil\Template\Stack');

/** @var \Foil\Template\Finder|\Mockery\MockInterface $finder */
$finder = $finder ? : Mockery::mock('Foil\Template\Finder');
$finder = $finder ?: Mockery::mock('Foil\Template\Finder');
if (is_null($events)) {
/** @var \Foil\Kernel\Events|\Mockery\MockInterface $events */
$events = Mockery::mock('Foil\Kernel\Events');
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Extension/AuraHtmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
class AuraHtmlTest extends TestCase
{

private function sut($register_tag_functions = false)
{
return new AuraHtml((new HelperLocatorFactory())->newInstance(), $register_tag_functions);
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Extension/BlocksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*/
class BlocksTest extends TestCase
{

public function testProvideFunctions()
{
/** @var \Foil\Blocks\Blocks $blocks */
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Extension/FiltersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class FiltersTest extends TestCase
{

/**
* @expectedException \InvalidArgumentException
*/
Expand Down
11 changes: 5 additions & 6 deletions tests/src/Unit/Extension/HelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
*/
class HelpersTest extends TestCase
{

/**
* @param array $data
* @param bool|string $strict
* @param bool $autoescape
* @param array $data
* @param bool|string $strict
* @param bool $autoescape
* @return \Foil\Extensions\Helpers
*/
private function getHelpers($data = [], $strict = false, $autoescape = true)
Expand Down Expand Up @@ -242,15 +241,15 @@ public function testAsArray()
{
$helpers = $this->getHelpers([
'string' => '<p>foo</p>',
'object' => (object)['id' => 'foo'],
'object' => (object) ['id' => 'foo'],
]);
assertSame([htmlentities('<p>foo</p>')], $helpers->asArray('string'));
assertSame(['id' => 'foo'], $helpers->asArray('object'));
}

public function testAsArrayRaw()
{
$helpers = $this->getHelpers(['object' => (object)['id' => '<p>foo</p>']]);
$helpers = $this->getHelpers(['object' => (object) ['id' => '<p>foo</p>']]);
assertSame(['id' => '<p>foo</p>'], $helpers->asArrayRaw('object'));
}

Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Extension/LinksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class LinksTest extends TestCase
{

public function testProvideFunctions()
{
$links = new Links();
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Extension/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class UriTest extends TestCase
{

public function testHome()
{
$u = new Uri();
Expand Down
3 changes: 1 addition & 2 deletions tests/src/Unit/Extension/WalkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
*/
class WalkerTest extends TestCase
{

/**
* @param bool $autoescape
* @param bool $autoescape
* @return \Foil\Extensions\Walker|\Mockery\MockInterface
*/
private function getWalker($autoescape = true)
Expand Down
9 changes: 4 additions & 5 deletions tests/src/Unit/Kernel/ArraizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
class ArraizeTest extends TestCase
{

private function e($var)
{
return call_user_func(new HtmlEscaper(), $var);
Expand All @@ -36,8 +35,8 @@ public function testScalars()
assertSame([$this->e('<b>foo bar</b>')], \Foil\arraize('<b>foo bar</b>', true));
assertSame([1], \Foil\arraize(1));
assertSame([true], \Foil\arraize(true));
assertSame([(string)1], \Foil\arraize(1, true, [], true));
assertSame([(string)true], \Foil\arraize(true, true, [], true));
assertSame([(string) 1], \Foil\arraize(1, true, [], true));
assertSame([(string) true], \Foil\arraize(true, true, [], true));
assertSame([], \Foil\arraize(null));
assertSame([], \Foil\arraize(false));
assertSame([], \Foil\arraize(''));
Expand Down Expand Up @@ -132,7 +131,7 @@ public function testMix()
$storage1 = new \SplObjectStorage();
$storage1->attach(new \stdClass());
$storage2 = new \SplObjectStorage();
$storage2->attach((object)['foo' => '<b>bar</b>']);
$storage2->attach((object) ['foo' => '<b>bar</b>']);
$data = [
'lev1' => new \ArrayIterator([
'lev1.1' => '<b>lev1.1</b>',
Expand All @@ -141,7 +140,7 @@ public function testMix()
]),
'lev2' => [
'lev2.2' => [
'lev2.2.1' => (object)['a' => '<b>a</b>', 'b' => '<b>b</b>'],
'lev2.2.1' => (object) ['a' => '<b>a</b>', 'b' => '<b>b</b>'],
'lev2.2.2' => [1, true, null],
],
],
Expand Down
3 changes: 1 addition & 2 deletions tests/src/Unit/Kernel/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
class CommandTest extends TestCase
{

/**
* @return \Foil\Contracts\EscaperInterface $escaper
*/
Expand Down Expand Up @@ -81,7 +80,7 @@ public function testFunctionNoEcho()
public function testFunctionObject()
{
$test1 = function () {
return (object)['foo' => 'bar'];
return (object) ['foo' => 'bar'];
};
$test2 = function () {
return 'foo';
Expand Down
5 changes: 2 additions & 3 deletions tests/src/Unit/Kernel/EscaperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
*/
class EscaperTest extends TestCase
{

/**
* @param mixed $data
* @param string $encoding
Expand Down Expand Up @@ -155,7 +154,7 @@ public function testAttr()
public function testObjectArr()
{
$escaper = new Escaper($this->auraEscaper(), 'utf-8');
$data = (object)['class' => ['foo', 'bar'], 'id' => 'foo'];
$data = (object) ['class' => ['foo', 'bar'], 'id' => 'foo'];
$expected = 'class="foo bar" id="foo"';

assertSame($expected, $escaper->escape($data, 'attr'));
Expand Down Expand Up @@ -201,7 +200,7 @@ public function testDecodeArray()

public function testDecodeObject()
{
$obj = (object)['a' => '<p>a</p>', 'b' => '<p>b</p>'];
$obj = (object) ['a' => '<p>a</p>', 'b' => '<p>b</p>'];
$objStr = Mockery::mock();
$objStr->shouldReceive('__toString')->andReturn($this->e('<p>a</p>'));

Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Kernel/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
class EventsTest extends TestCase
{

public function testFire()
{
$e = new Events();
Expand Down
1 change: 0 additions & 1 deletion tests/src/Unit/Section/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
class FactoryTest extends TestCase
{

/**
* @expectedException \InvalidArgumentException
*/
Expand Down
Loading

0 comments on commit d2b8280

Please sign in to comment.