first/last name instead ofj ust name, fix og migration instead of updating in second file sqlite issue
This commit is contained in:
@@ -3,7 +3,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace CakeContactUs\Test\Fixture;
|
||||
|
||||
use Cake\I18n\FrozenTime;
|
||||
use Cake\TestSuite\Fixture\TestFixture;
|
||||
use Cake\Utility\Text;
|
||||
|
||||
/**
|
||||
* ContactUsFormSubmissionsFixture
|
||||
@@ -18,7 +20,21 @@ class ContactUsFormSubmissionsFixture extends TestFixture {
|
||||
* @return void
|
||||
*/
|
||||
public function init(): void {
|
||||
$this->records = [];
|
||||
$this->records = [
|
||||
[
|
||||
'id' => Text::uuid(),
|
||||
'submitted_at' => new FrozenTime(),
|
||||
'client_ip' => 'cli',
|
||||
'first_name' => 'test',
|
||||
'last_name' => 'test',
|
||||
'email' => 'test@test.com',
|
||||
'contact_subject' => 'subject',
|
||||
'message' => 'what are your business hours?',
|
||||
'confirm_email_sent' => true,
|
||||
'backend_email_sent' => true,
|
||||
],
|
||||
];
|
||||
|
||||
parent::init();
|
||||
}
|
||||
|
||||
|
||||
@@ -72,13 +72,14 @@ class ContactUsComponentTest extends TestCase {
|
||||
* @return void
|
||||
*/
|
||||
public function testProcessContactUsFormSaved() {
|
||||
$numSubmissionsBefore = $this->fetchTable('CakeContactUs/ContactUsFormSubmissions')->find()->count();
|
||||
$numSubmissionsBefore = $this->fetchTable('CakeContactUs.ContactUsFormSubmissions')->find()->count();
|
||||
$result = $this->component->processContactUsForm($this->component->newContactUsForm(), [
|
||||
'name' => 'Jane Doe',
|
||||
'first_name' => 'Jane Doe',
|
||||
'email' => 'test@example.com',
|
||||
'message' => 'contact us message',
|
||||
]);
|
||||
$this->assertNotInstanceOf(ContactUsFormSubmission::class, $result);
|
||||
$numSubmissionsAfter = $this->fetchTable('CakeContactUs/ContactUsFormSubmissions')->find()->count();
|
||||
$numSubmissionsAfter = $this->fetchTable('CakeContactUs.ContactUsFormSubmissions')->find()->count();
|
||||
$this->assertEquals($numSubmissionsBefore + 1, $numSubmissionsAfter);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ class ContactUsFormSubmissionsControllerTest extends TestCase {
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [
|
||||
'name' => 'valid name',
|
||||
'first_name' => 'valid name',
|
||||
'email' => 'valid_email@test.com',
|
||||
'message' => 'valid message goes here',
|
||||
];
|
||||
@@ -156,7 +156,7 @@ class ContactUsFormSubmissionsControllerTest extends TestCase {
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [
|
||||
'name' => 'valid name',
|
||||
'first_name' => 'valid name',
|
||||
'email' => 'valid_email@test.com',
|
||||
'message' => 'valid message goes here',
|
||||
];
|
||||
@@ -203,7 +203,7 @@ class ContactUsFormSubmissionsControllerTest extends TestCase {
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [
|
||||
'name' => 'valid name',
|
||||
'first_name' => 'valid name',
|
||||
'email' => 'valid_email@test.com',
|
||||
'message' => 'valid message goes here',
|
||||
];
|
||||
@@ -251,7 +251,7 @@ class ContactUsFormSubmissionsControllerTest extends TestCase {
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [
|
||||
'name' => 'valid name',
|
||||
'first_name' => 'valid name',
|
||||
'email' => 'valid_email@test.com',
|
||||
'message' => 'valid message goes here',
|
||||
];
|
||||
@@ -290,7 +290,7 @@ class ContactUsFormSubmissionsControllerTest extends TestCase {
|
||||
'action' => 'add',
|
||||
];
|
||||
$data = [
|
||||
'name' => 'valid name',
|
||||
'first_name' => 'valid name',
|
||||
'email' => 'not_valid_email',
|
||||
'message' => 'this is a valid message ',
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user