Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8956f00475 | ||
|
|
dc15cf8463 | ||
|
|
1add9b421a |
No files matched your search
+1
-1
@@ -1,9 +1,9 @@
|
|||||||
language: php
|
language: php
|
||||||
|
|
||||||
php:
|
php:
|
||||||
|
- 5.5
|
||||||
- 5.6
|
- 5.6
|
||||||
- 7.0
|
- 7.0
|
||||||
- 7.1
|
|
||||||
- hhvm
|
- hhvm
|
||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|||||||
+9
-9
@@ -18,17 +18,17 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.6.4",
|
"php": ">=5.5.9",
|
||||||
"illuminate/http": "5.3.*",
|
"illuminate/http": "5.2.*",
|
||||||
"illuminate/routing": "5.3.*",
|
"illuminate/routing": "5.2.*",
|
||||||
"illuminate/session": "5.3.*",
|
"illuminate/session": "5.2.*",
|
||||||
"illuminate/support": "5.3.*",
|
"illuminate/support": "5.2.*",
|
||||||
"illuminate/view": "5.3.*"
|
"illuminate/view": "5.2.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"illuminate/database": "5.3.*",
|
"illuminate/database": "5.2.*",
|
||||||
"mockery/mockery": "~0.9.4",
|
"mockery/mockery": "~0.9",
|
||||||
"phpunit/phpunit": "~5.4"
|
"phpunit/phpunit": "~4.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ trait FormAccessible
|
|||||||
$methods = $this->getReflection()->getMethods(ReflectionMethod::IS_PUBLIC);
|
$methods = $this->getReflection()->getMethods(ReflectionMethod::IS_PUBLIC);
|
||||||
|
|
||||||
$mutator = collect($methods)
|
$mutator = collect($methods)
|
||||||
->first(function (ReflectionMethod $method) use ($key) {
|
->first(function ($index, ReflectionMethod $method) use ($key) {
|
||||||
return $method->getName() == 'form' . Str::studly($key) . 'Attribute';
|
return $method->getName() == 'form' . Str::studly($key) . 'Attribute';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -448,6 +448,11 @@ class HtmlBuilder
|
|||||||
$key = $value;
|
$key = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Treat boolean attributes as HTML properties
|
||||||
|
if (is_bool($value)) {
|
||||||
|
return $value ? $key : '';
|
||||||
|
}
|
||||||
|
|
||||||
if (! is_null($value)) {
|
if (! is_null($value)) {
|
||||||
return $key . '="' . e($value) . '"';
|
return $key . '="' . e($value) . '"';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,4 +115,15 @@ class HtmlBuilderTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('<a href="mailto:person@example.com" class="example-link"><span>First Name Last</span></a>', $result1);
|
$this->assertEquals('<a href="mailto:person@example.com" class="example-link"><span>First Name Last</span></a>', $result1);
|
||||||
$this->assertEquals('<a href="mailto:person@example.com" class="example-link"><span>First Name Last</span></a>', $result2);
|
$this->assertEquals('<a href="mailto:person@example.com" class="example-link"><span>First Name Last</span></a>', $result2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testBooleanAttributes()
|
||||||
|
{
|
||||||
|
$result1 = $this->htmlBuilder->attributes(['my-property' => true]);
|
||||||
|
|
||||||
|
$result2 = $this->htmlBuilder->attributes(['my-property' => false]);
|
||||||
|
|
||||||
|
$this->assertEquals('my-property', trim($result1));
|
||||||
|
|
||||||
|
$this->assertEquals('', trim($result2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user