feat: soporte para Laravel 12 y Laravel 13
- Requisitos: PHP 8.2 o superior e illuminate 11, 12 o 13. - selectMonth usa Carbon isoFormat en lugar de strftime, deprecada desde PHP 8.1; acepta los formatos anteriores y respeta el locale de la aplicación. - Nulos explícitos en los constructores de HtmlBuilder y FormBuilder para PHP 8.4. - Pruebas para PHPUnit 10.5, 11.5 y 12, con propiedades declaradas y sin avisos de deprecación. - Readme con instrucciones para instalar desde el registro Composer de git.ilj.mx.
This commit is contained in:
1 parent
ef6c0b7940
commit
596d90d940
9 files changed
+134
-54
No files matched your search
@@ -14,6 +14,13 @@ use Mockery as m;
|
||||
|
||||
class FormAccessibleTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected $formBuilder;
|
||||
protected $htmlBuilder;
|
||||
protected $modelData;
|
||||
protected $now;
|
||||
protected $urlGenerator;
|
||||
protected $viewFactory;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
Capsule::table('models')->truncate();
|
||||
|
||||
@@ -14,6 +14,10 @@ use Mockery as m;
|
||||
|
||||
class FormBuilderTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected $htmlBuilder;
|
||||
protected $urlGenerator;
|
||||
protected $viewFactory;
|
||||
|
||||
/**
|
||||
* @var FormBuilder
|
||||
*/
|
||||
@@ -697,6 +701,38 @@ class FormBuilderTest extends PHPUnit\Framework\TestCase
|
||||
$this->assertStringContainsString('<select id="foo" name="month"><option value="1">January</option>', $month3);
|
||||
}
|
||||
|
||||
public function testFormSelectMonthAcceptsLegacyStrftimeFormats()
|
||||
{
|
||||
$long = (string) $this->formBuilder->selectMonth('month', null, [], '%B');
|
||||
$short = (string) $this->formBuilder->selectMonth('month', null, [], '%b');
|
||||
$numeric = (string) $this->formBuilder->selectMonth('month', null, [], '%m');
|
||||
|
||||
$this->assertStringContainsString('<option value="1">January</option>', $long);
|
||||
$this->assertStringContainsString('<option value="2">Feb</option>', $short);
|
||||
$this->assertStringContainsString('<option value="12">12</option>', $numeric);
|
||||
}
|
||||
|
||||
public function testFormSelectMonthAcceptsIsoFormats()
|
||||
{
|
||||
$short = (string) $this->formBuilder->selectMonth('month', null, [], 'MMM');
|
||||
|
||||
$this->assertStringContainsString('<option value="3">Mar</option>', $short);
|
||||
}
|
||||
|
||||
public function testFormSelectMonthFollowsCarbonLocale()
|
||||
{
|
||||
$previous = \Illuminate\Support\Carbon::getLocale();
|
||||
\Illuminate\Support\Carbon::setLocale('es');
|
||||
|
||||
try {
|
||||
$months = (string) $this->formBuilder->selectMonth('month');
|
||||
} finally {
|
||||
\Illuminate\Support\Carbon::setLocale($previous);
|
||||
}
|
||||
|
||||
$this->assertStringContainsString('<option value="1">enero</option>', $months);
|
||||
}
|
||||
|
||||
public function testFormCheckbox()
|
||||
{
|
||||
$this->formBuilder->setSessionStore($session = m::mock('Illuminate\Contracts\Session\Session'));
|
||||
|
||||
@@ -9,6 +9,10 @@ use Mockery as m;
|
||||
|
||||
class HtmlBuilderTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected $htmlBuilder;
|
||||
protected $urlGenerator;
|
||||
protected $viewFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Setup the test environment.
|
||||
|
||||
Reference in new issue
Block a user