v0.0.15 - catalags & apis many to many wip
This commit is contained in:
@@ -4,8 +4,10 @@ declare(strict_types=1);
|
||||
namespace CakeProducts\Test\TestCase\Controller;
|
||||
|
||||
use App\Controller\ExternalProductCatalogsProductCatalogsController;
|
||||
use Cake\ORM\Table;
|
||||
use Cake\TestSuite\IntegrationTestTrait;
|
||||
use Cake\TestSuite\TestCase;
|
||||
use CakeProducts\Model\Table\ExternalProductCatalogsProductCatalogsTable;
|
||||
use PHPUnit\Exception;
|
||||
|
||||
/**
|
||||
@@ -15,15 +17,21 @@ use PHPUnit\Exception;
|
||||
*/
|
||||
class ExternalProductCatalogsProductCatalogsControllerTest extends BaseControllerTest
|
||||
{
|
||||
/**
|
||||
* Test subject table
|
||||
*
|
||||
* @var ExternalProductCatalogsProductCatalogsTable|Table
|
||||
*/
|
||||
protected $ExternalProductCatalogsProductCatalogs;
|
||||
/**
|
||||
* Fixtures
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'CakeProducts.ExternalProductCatalogsProductCatalogs',
|
||||
'CakeProducts.ExternalProductCatalogs',
|
||||
'CakeProducts.ExternalProductCatalogs',
|
||||
'plugin.CakeProducts.ExternalProductCatalogsProductCatalogs',
|
||||
'plugin.CakeProducts.ExternalProductCatalogs',
|
||||
'plugin.CakeProducts.ProductCatalogs',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -68,6 +76,7 @@ class ExternalProductCatalogsProductCatalogsControllerTest extends BaseControlle
|
||||
|
||||
// $this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeProducts',
|
||||
'controller' => 'ExternalProductCatalogsProductCatalogs',
|
||||
'action' => 'add',
|
||||
];
|
||||
@@ -78,61 +87,6 @@ class ExternalProductCatalogsProductCatalogsControllerTest extends BaseControlle
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
* Tests a POST request to the add action with a logged in user
|
||||
*
|
||||
* @uses \App\Controller\ExternalProductCatalogsProductCatalogsController::add()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddPostSuccess(): void
|
||||
{
|
||||
$cntBefore = $this->ExternalProductCatalogsProductCatalogs->find()->count();
|
||||
|
||||
// $this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'controller' => 'ExternalProductCatalogsProductCatalogs',
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [];
|
||||
$this->post($url, $data);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('externalproductcatalogsproductcatalogs/view');
|
||||
|
||||
$cntAfter = $this->ExternalProductCatalogsProductCatalogs->find()->count();
|
||||
$this->assertEquals($cntBefore + 1, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test add method
|
||||
*
|
||||
* Tests a POST request to the add action with a logged in user
|
||||
*
|
||||
* @uses \App\Controller\ExternalProductCatalogsProductCatalogsController::add()
|
||||
* @throws Exception
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAddPostFailure(): void
|
||||
{
|
||||
$cntBefore = $this->ExternalProductCatalogsProductCatalogs->find()->count();
|
||||
|
||||
// $this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'controller' => 'ExternalProductCatalogsProductCatalogs',
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [];
|
||||
$this->post($url, $data);
|
||||
$this->assertResponseCode(200);
|
||||
|
||||
$cntAfter = $this->ExternalProductCatalogsProductCatalogs->find()->count();
|
||||
$this->assertEquals($cntBefore, $cntAfter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method
|
||||
*
|
||||
@@ -149,6 +103,7 @@ class ExternalProductCatalogsProductCatalogsControllerTest extends BaseControlle
|
||||
|
||||
// $this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeProducts',
|
||||
'controller' => 'ExternalProductCatalogsProductCatalogs',
|
||||
'action' => 'delete',
|
||||
1,
|
||||
|
||||
Reference in New Issue
Block a user