first standalone plugin commit
This commit is contained in:
97
tests/TestCase/Model/Table/RegionsTableTest.php
Normal file
97
tests/TestCase/Model/Table/RegionsTableTest.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace CakeAddresses\Test\TestCase\Model\Table;
|
||||
|
||||
use Cake\TestSuite\TestCase;
|
||||
use CakeAddresses\Model\Table\RegionsTable;
|
||||
|
||||
/**
|
||||
* CakeAddresses\Model\Table\RegionsTable Test Case
|
||||
*/
|
||||
class RegionsTableTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test subject
|
||||
*
|
||||
* @var \CakeAddresses\Model\Table\RegionsTable
|
||||
*/
|
||||
protected $Regions;
|
||||
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeAddresses.Regions',
|
||||
'plugin.CakeAddresses.Countries',
|
||||
'plugin.CakeAddresses.Subregions',
|
||||
];
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('Regions') ? [] : ['className' => RegionsTable::class];
|
||||
$this->Regions = $this->getTableLocator()->get('Regions', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
unset($this->Regions);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* TestInitialize method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\RegionsTable::initialize()
|
||||
*/
|
||||
public function testInitialize(): void
|
||||
{
|
||||
// verify all associations loaded
|
||||
$expectedAssociations = [
|
||||
'Countries',
|
||||
'Subregions',
|
||||
// 'States',
|
||||
];
|
||||
$associations = $this->Regions->associations();
|
||||
|
||||
$this->assertCount(count($expectedAssociations), $associations);
|
||||
foreach ($expectedAssociations as $expectedAssociation) {
|
||||
$this->assertTrue($this->Regions->hasAssociation($expectedAssociation));
|
||||
}
|
||||
|
||||
// verify all behaviors loaded
|
||||
$expectedBehaviors = [];
|
||||
$behaviors = $this->Regions->behaviors();
|
||||
|
||||
$this->assertCount(count($expectedBehaviors), $behaviors);
|
||||
foreach ($expectedBehaviors as $expectedBehavior) {
|
||||
$this->assertTrue($this->Regions->hasBehavior($expectedBehavior));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test validationDefault method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeAddresses\Model\Table\RegionsTable::validationDefault()
|
||||
*/
|
||||
public function testValidationDefault(): void
|
||||
{
|
||||
$this->markTestIncomplete('Not implemented yet.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user