tests should be working / build should suceed now
Some checks failed
CI / testsuite (mysql, 8.2, ) (push) Failing after 4m30s
CI / testsuite (pgsql, 8.2, ) (push) Failing after 8m57s
CI / testsuite (mysql, 8.4, ) (push) Has started running
CI / testsuite (pgsql, 8.4, ) (push) Has started running
CI / testsuite (sqlite, 8.2, ) (push) Has started running
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Has been cancelled
CI / testsuite (sqlite, 8.4, ) (push) Has been cancelled
CI / Coding Standard & Static Analysis (push) Has been cancelled
Some checks failed
CI / testsuite (mysql, 8.2, ) (push) Failing after 4m30s
CI / testsuite (pgsql, 8.2, ) (push) Failing after 8m57s
CI / testsuite (mysql, 8.4, ) (push) Has started running
CI / testsuite (pgsql, 8.4, ) (push) Has started running
CI / testsuite (sqlite, 8.2, ) (push) Has started running
CI / testsuite (sqlite, 8.2, prefer-lowest) (push) Has been cancelled
CI / testsuite (sqlite, 8.4, ) (push) Has been cancelled
CI / Coding Standard & Static Analysis (push) Has been cancelled
This commit is contained in:
@@ -5,10 +5,10 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"cakephp/cakephp": "^5.0.1"
|
||||
"cakephp/cakephp": "^5.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^10.1",
|
||||
"phpunit/phpunit": "^10.3",
|
||||
"cakephp/migrations": "^4.0.0",
|
||||
"phpstan/phpstan": "^2.1",
|
||||
"dereuromark/composer-prefer-lowest": "^0.1.10",
|
||||
|
||||
@@ -3,7 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace CakeContactUs\Test\Fixture;
|
||||
|
||||
use Cake\I18n\FrozenTime;
|
||||
use Cake\TestSuite\Fixture\TestFixture;
|
||||
use Cake\Utility\Text;
|
||||
|
||||
@@ -12,8 +11,6 @@ use Cake\Utility\Text;
|
||||
*/
|
||||
class ContactUsFormSubmissionsFixture extends TestFixture {
|
||||
|
||||
public string $table = 'contact_us_form_submissions';
|
||||
|
||||
/**
|
||||
* Init method
|
||||
*
|
||||
@@ -23,7 +20,7 @@ class ContactUsFormSubmissionsFixture extends TestFixture {
|
||||
$this->records = [
|
||||
[
|
||||
'id' => Text::uuid(),
|
||||
'submitted_at' => new FrozenTime(),
|
||||
'submitted_at' => '2018-07-21 16:11:03',
|
||||
'client_ip' => 'cli',
|
||||
'first_name' => 'test',
|
||||
'last_name' => 'test',
|
||||
|
||||
@@ -9,6 +9,7 @@ use Cake\Http\ServerRequest;
|
||||
use Cake\TestSuite\TestCase;
|
||||
use CakeContactUs\Controller\Component\ContactUsComponent;
|
||||
use CakeContactUs\Model\Entity\ContactUsFormSubmission;
|
||||
use CakeContactUs\Test\Fixture\ContactUsFormSubmissionsFixture;
|
||||
|
||||
/**
|
||||
* CakeContactUs\Controller\Component\ContactUsComponent Test Case
|
||||
@@ -25,7 +26,7 @@ class ContactUsComponentTest extends TestCase {
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeContactUs.ContactUsFormSubmissions',
|
||||
ContactUsFormSubmissionsFixture::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,7 @@ use Cake\TestSuite\EmailTrait;
|
||||
use Cake\TestSuite\IntegrationTestTrait;
|
||||
use Cake\TestSuite\TestCase;
|
||||
use CakeContactUs\CakeContactUsPlugin;
|
||||
use CakeContactUs\Test\Fixture\ContactUsFormSubmissionsFixture;
|
||||
|
||||
/**
|
||||
* CakeContactUs\Controller\ContactUsFormSubmissionsController Test Case
|
||||
@@ -31,7 +32,7 @@ class ContactUsFormSubmissionsControllerTest extends TestCase {
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeContactUs.ContactUsFormSubmissions',
|
||||
ContactUsFormSubmissionsFixture::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -41,7 +42,7 @@ class ContactUsFormSubmissionsControllerTest extends TestCase {
|
||||
*/
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->ContactUsFormSubmissions = $this->getTableLocator()->get('ContactUsFormSubmissions');
|
||||
$this->ContactUsFormSubmissions = $this->getTableLocator()->get('CakeContactUs.ContactUsFormSubmissions');
|
||||
|
||||
EventManager::instance()->setEventList(new EventList());
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ class ContactUsFormSubmissionsTableTest extends TestCase {
|
||||
*/
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$config = $this->getTableLocator()->exists('ContactUsFormSubmissions') ? [] : ['className' => ContactUsFormSubmissionsTable::class];
|
||||
$this->ContactUsFormSubmissions = $this->getTableLocator()->get('ContactUsFormSubmissions', $config);
|
||||
$config = $this->getTableLocator()->exists('CakeContactUs.ContactUsFormSubmissions') ? [] : ['className' => ContactUsFormSubmissionsTable::class];
|
||||
$this->ContactUsFormSubmissions = $this->getTableLocator()->get('CakeContactUs.ContactUsFormSubmissions', $config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ use Cake\Datasource\ConnectionManager;
|
||||
use Cake\Mailer\Mailer;
|
||||
use Cake\Mailer\Transport\DebugTransport;
|
||||
use Cake\Mailer\TransportFactory;
|
||||
use Cake\TestSuite\Fixture\SchemaLoader;
|
||||
use CakeContactUs\CakeContactUsPlugin;
|
||||
use Migrations\TestSuite\Migrator;
|
||||
use TestApp\Controller\AppController;
|
||||
@@ -155,7 +156,7 @@ ConnectionManager::setConfig('test', [
|
||||
* and using \Migrations\TestSuite\Migrator to load schema.
|
||||
*/
|
||||
// Load a schema dump file.
|
||||
//(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test');
|
||||
(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test');
|
||||
if (!defined('SECOND')) {
|
||||
define('SECOND', 1);
|
||||
define('MINUTE', 60);
|
||||
@@ -166,11 +167,11 @@ if (!defined('SECOND')) {
|
||||
define('YEAR', 31536000);
|
||||
}
|
||||
|
||||
$migrator = new Migrator();
|
||||
$migrator->runMany([
|
||||
// Run app migrations on test connection.
|
||||
['connection' => 'test'],
|
||||
// Run plugin migrations on test connection.
|
||||
['plugin' => 'CakeContactUs'],
|
||||
['plugin' => 'Captcha'],
|
||||
]);
|
||||
//$migrator = new Migrator();
|
||||
//$migrator->runMany([
|
||||
// // Run app migrations on test connection.
|
||||
// ['connection' => 'test'],
|
||||
// // Run plugin migrations on test connection.
|
||||
// ['plugin' => 'CakeContactUs'],
|
||||
// ['plugin' => 'Captcha'],
|
||||
//]);
|
||||
|
||||
44
tests/schema.php
Normal file
44
tests/schema.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Based entirely off of dereuromark's plugins as I was having trouble getting fixtures to load
|
||||
* after moving the plugins outside of an existing cakephp app's plugins folder
|
||||
*
|
||||
* @link https://github.com/dereuromark/cakephp-tools/blob/master/tests/schema.php
|
||||
*/
|
||||
use Cake\Utility\Inflector;
|
||||
|
||||
$tables = [];
|
||||
|
||||
/**
|
||||
* @var \DirectoryIterator<\DirectoryIterator> $iterator
|
||||
*/
|
||||
$iterator = new DirectoryIterator(__DIR__ . DS . 'Fixture');
|
||||
foreach ($iterator as $file) {
|
||||
if (!preg_match('/(\w+)Fixture.php$/', (string)$file, $matches)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = $matches[1];
|
||||
$tableName = Inflector::underscore($name);
|
||||
$class = 'CakeContactUs\\Test\\Fixture\\' . $name . 'Fixture';
|
||||
try {
|
||||
$object = (new ReflectionClass($class))->getProperty('fields');
|
||||
} catch (ReflectionException $e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$array = $object->getDefaultValue();
|
||||
$constraints = $array['_constraints'] ?? [];
|
||||
$indexes = $array['_indexes'] ?? [];
|
||||
unset($array['_constraints'], $array['_indexes'], $array['_options']);
|
||||
$table = [
|
||||
'table' => $tableName,
|
||||
'columns' => $array,
|
||||
'constraints' => $constraints,
|
||||
'indexes' => $indexes,
|
||||
];
|
||||
$tables[$tableName] = $table;
|
||||
}
|
||||
|
||||
return $tables;
|
||||
@@ -1 +1,15 @@
|
||||
-- Test database schema for CakeContactUs
|
||||
CREATE TABLE `contact_us_form_submissions`
|
||||
(
|
||||
`id` char(36) NOT NULL,
|
||||
`submitted_at` datetime NOT NULL,
|
||||
`client_ip` varchar(45) DEFAULT NULL,
|
||||
`first_name` varchar(255) DEFAULT NULL,
|
||||
`last_name` varchar(255) DEFAULT NULL,
|
||||
`email` varchar(255) DEFAULT NULL,
|
||||
`contact_subject` varchar(255) DEFAULT NULL,
|
||||
`message` text NOT NULL,
|
||||
`confirm_email_sent` datetime DEFAULT NULL,
|
||||
`backend_email_sent` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user