From 70f6fe8ca559afc5c7a48bb12081d2b8181e365e Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Wed, 14 Apr 2021 10:59:53 +0000 Subject: [PATCH] update test fixtures with actual data set --- .../Fixture/StateUserTransactionsFixture.php | 27 +++++--- .../Fixture/TransactionCreationsFixture.php | 42 +++---------- .../Fixture/TransactionSendCoinsFixture.php | 33 +++++----- .../tests/Fixture/TransactionsFixture.php | 61 ++++++------------- 4 files changed, 63 insertions(+), 100 deletions(-) diff --git a/community_server/tests/Fixture/StateUserTransactionsFixture.php b/community_server/tests/Fixture/StateUserTransactionsFixture.php index c1aadb046..37a132eb5 100644 --- a/community_server/tests/Fixture/StateUserTransactionsFixture.php +++ b/community_server/tests/Fixture/StateUserTransactionsFixture.php @@ -6,7 +6,7 @@ use Cake\TestSuite\Fixture\TestFixture; /** * StateUserTransactionsFixture */ -class StateUserTransactionsFixture extends TestFixture +class StateUserTransactionsFixture extends BaseTestFixture { /** * Fields @@ -19,6 +19,8 @@ class StateUserTransactionsFixture extends TestFixture 'state_user_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], 'transaction_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], 'transaction_type_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], + 'balance' => ['type' => 'biginteger', 'length' => 20, 'unsigned' => false, 'null' => true, 'default' => '0', 'comment' => '', 'precision' => null, 'autoIncrement' => null], + 'balance_date' => ['type' => 'timestamp', 'length' => null, 'null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '', 'precision' => null], '_constraints' => [ 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []], ], @@ -35,14 +37,23 @@ class StateUserTransactionsFixture extends TestFixture */ public function init() { - $this->records = [ - [ - 'id' => 1, - 'state_user_id' => 1, - 'transaction_id' => 1, - 'transaction_type_id' => 1, - ], + $sql = [ + [1, 4, 1, 1, 0, '2021-04-09 00:00:00'], + [2, 1, 2, 1, 0, '2021-04-12 00:00:00'], + [5, 1, 3, 2, 0, '2021-04-12 00:00:00'], + [6, 4, 3, 2, 0, '2021-04-12 00:00:00'], + [7, 1, 4, 2, 0, '2021-04-14 00:00:00'], + [8, 4, 4, 2, 0, '2021-04-14 00:00:00'], + [23, 1, 5, 2, 0, '2021-04-14 09:01:07'], + [24, 4, 5, 2, 0, '2021-04-14 09:01:07'], + [25, 4, 6, 2, 0, '2021-04-14 09:02:28'], + [26, 1, 6, 2, 0, '2021-04-14 09:02:28'], + [27, 4, 7, 2, 0, '2021-04-14 09:28:46'], + [28, 1, 7, 2, 0, '2021-04-14 09:28:46'], + [29, 4, 8, 2, 0, '2021-04-14 09:31:28'], + [30, 1, 8, 2, 0, '2021-04-14 09:31:28'] ]; + $this->records = $this->sqlEntrysToRecords($sql, $this->fields); parent::init(); } } diff --git a/community_server/tests/Fixture/TransactionCreationsFixture.php b/community_server/tests/Fixture/TransactionCreationsFixture.php index 593c9efe4..f0627d89e 100644 --- a/community_server/tests/Fixture/TransactionCreationsFixture.php +++ b/community_server/tests/Fixture/TransactionCreationsFixture.php @@ -6,7 +6,7 @@ use Cake\TestSuite\Fixture\TestFixture; /** * TransactionCreationsFixture */ -class TransactionCreationsFixture extends TestFixture +class TransactionCreationsFixture extends BaseTestFixture { /** * Fields @@ -15,17 +15,18 @@ class TransactionCreationsFixture extends TestFixture */ // @codingStandardsIgnoreStart public $fields = [ - 'id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], - 'transaction_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], - 'state_user_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], + 'id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null], + 'transaction_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], + 'state_user_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], 'amount' => ['type' => 'biginteger', 'length' => 20, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], 'ident_hash' => ['type' => 'binary', 'length' => 32, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null], + 'target_date' => ['type' => 'timestamp', 'length' => null, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null], '_constraints' => [ 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []], ], '_options' => [ 'engine' => 'InnoDB', - 'collation' => 'utf8_bin' + 'collation' => 'utf8mb4_unicode_ci' ], ]; // @codingStandardsIgnoreEnd @@ -36,34 +37,11 @@ class TransactionCreationsFixture extends TestFixture */ public function init() { - - // (1, 1, 2, 10000000, 0x3235303332373635330000000000000000000000000000000000000000000000, '2020-12-01 00:00:00'), - // (2, 2, 2, 10000000, 0x3235303332373635330000000000000000000000000000000000000000000000, '2021-01-01 00:00:00'), - // (3, 3, 2, 10000000, 0x3235303332373635330000000000000000000000000000000000000000000000, '2021-02-01 00:00:00'); - - $this->records = [ - [ - 'id' => 1, - 'transaction_id' => 1, - 'state_user_id' => 1, - 'amount' => 10000000, - 'ident_hash' => hex2bin('3235303332373635330000000000000000000000000000000000000000000000') - ], - [ - 'id' => 2, - 'transaction_id' => 2, - 'state_user_id' => 1, - 'amount' => 10000000, - 'ident_hash' => hex2bin('3235303332373635330000000000000000000000000000000000000000000000') - ], - [ - 'id' => 3, - 'transaction_id' => 3, - 'state_user_id' => 1, - 'amount' => 10000000, - 'ident_hash' => hex2bin('3235303332373635330000000000000000000000000000000000000000000000') - ], + $sql = [ + [2, 1, 4, 10000000, 0x0000000000000000000000000000000000000000000000000000000000000000, '2021-01-01 00:00:00'], + [3, 2, 1, 10000000, 0x0000000000000000000000000000000000000000000000000000000000000000, '2021-01-01 00:00:00'] ]; + $this->records = $this->sqlEntrysToRecords($sql, $this->fields); parent::init(); } } diff --git a/community_server/tests/Fixture/TransactionSendCoinsFixture.php b/community_server/tests/Fixture/TransactionSendCoinsFixture.php index d3686a3b2..fb9b30db3 100644 --- a/community_server/tests/Fixture/TransactionSendCoinsFixture.php +++ b/community_server/tests/Fixture/TransactionSendCoinsFixture.php @@ -6,7 +6,7 @@ use Cake\TestSuite\Fixture\TestFixture; /** * TransactionSendCoinsFixture */ -class TransactionSendCoinsFixture extends TestFixture +class TransactionSendCoinsFixture extends BaseTestFixture { /** * Fields @@ -15,11 +15,12 @@ class TransactionSendCoinsFixture extends TestFixture */ // @codingStandardsIgnoreStart public $fields = [ - 'id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], - 'transaction_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], - 'state_user_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], + 'id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null], + 'transaction_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], + 'sender_public_key' => ['type' => 'binary', 'length' => 32, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null], + 'state_user_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => true, 'default' => '0', 'comment' => '', 'precision' => null, 'autoIncrement' => null], 'receiver_public_key' => ['type' => 'binary', 'length' => 32, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null], - 'receiver_user_id' => ['type' => 'binary', 'length' => 64, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null], + 'receiver_user_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => true, 'default' => '0', 'comment' => '', 'precision' => null, 'autoIncrement' => null], 'amount' => ['type' => 'biginteger', 'length' => 20, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], 'sender_final_balance' => ['type' => 'biginteger', 'length' => 20, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], '_constraints' => [ @@ -27,7 +28,7 @@ class TransactionSendCoinsFixture extends TestFixture ], '_options' => [ 'engine' => 'InnoDB', - 'collation' => 'utf8_bin' + 'collation' => 'utf8mb4_unicode_ci' ], ]; // @codingStandardsIgnoreEnd @@ -38,18 +39,16 @@ class TransactionSendCoinsFixture extends TestFixture */ public function init() { - // (1, 4, 2, 0x80183e03535d17a54ff1fd7dbaed86939d423a19a258c26b8e338ce601338355, 1, 15000000, 15000000); - $this->records = [ - [ - 'id' => 1, - 'transaction_id' => 4, - 'state_user_id' => 1, - 'receiver_public_key' => '8190bda585ee5f1d9fbf7d06e81e69ec18e13376104cff54b7457eb7d3ef710d', - 'receiver_user_id' => 4, - 'amount' => 15000000, - 'sender_final_balance' => 15000000 - ], + $sql = [ + [2, 3, 0x0000000000000000000000000000000000000000000000000000000000000000, 1, 0xe3369de3623ce8446d0424c4013e7a1d71a2671ae3d7bf1e798ebf0665d145f2, 4, 1000000, 6254699], + [3, 4, 0x0000000000000000000000000000000000000000000000000000000000000000, 1, 0xe3369de3623ce8446d0424c4013e7a1d71a2671ae3d7bf1e798ebf0665d145f2, 4, 100000, 7027197], + [11, 5, 0x0000000000000000000000000000000000000000000000000000000000000000, 1, 0xe3369de3623ce8446d0424c4013e7a1d71a2671ae3d7bf1e798ebf0665d145f2, 4, 100000, 6922113], + [12, 6, 0x0000000000000000000000000000000000000000000000000000000000000000, 4, 0xf7f4a49a4ac10379f8b9ddcb731c4d9ec495e6edd16075f52672cd25e3179f0f, 1, 100000, 9212951], + [13, 7, 0x0000000000000000000000000000000000000000000000000000000000000000, 4, 0xf7f4a49a4ac10379f8b9ddcb731c4d9ec495e6edd16075f52672cd25e3179f0f, 1, 100000, 9112627], + [14, 8, 0x0000000000000000000000000000000000000000000000000000000000000000, 4, 0xf7f4a49a4ac10379f8b9ddcb731c4d9ec495e6edd16075f52672cd25e3179f0f, 1, 100000, 8912594] ]; + + $this->records = $this->sqlEntrysToRecords($sql, $this->fields); parent::init(); } } diff --git a/community_server/tests/Fixture/TransactionsFixture.php b/community_server/tests/Fixture/TransactionsFixture.php index 0a1be1341..041aa834b 100644 --- a/community_server/tests/Fixture/TransactionsFixture.php +++ b/community_server/tests/Fixture/TransactionsFixture.php @@ -6,7 +6,7 @@ use Cake\TestSuite\Fixture\TestFixture; /** * TransactionsFixture */ -class TransactionsFixture extends TestFixture +class TransactionsFixture extends BaseTestFixture { /** * Fields @@ -15,17 +15,19 @@ class TransactionsFixture extends TestFixture */ // @codingStandardsIgnoreStart public $fields = [ - 'id' => ['type' => 'biginteger', 'length' => 20, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], - 'state_group_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], - 'transaction_type_id' => ['type' => 'integer', 'length' => 11, 'unsigned' => false, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], - 'tx_hash' => ['type' => 'binary', 'length' => 32, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null], + 'id' => ['type' => 'biginteger', 'length' => 20, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null], + 'state_group_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], + 'transaction_type_id' => ['type' => 'integer', 'length' => 10, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'precision' => null, 'autoIncrement' => null], + 'tx_hash' => ['type' => 'binary', 'length' => 48, 'null' => true, 'default' => null, 'comment' => '', 'precision' => null], + 'memo' => ['type' => 'string', 'length' => 255, 'null' => false, 'default' => null, 'collate' => 'utf8mb4_unicode_ci', 'comment' => '', 'precision' => null, 'fixed' => null], 'received' => ['type' => 'timestamp', 'length' => null, 'null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '', 'precision' => null], + 'blockchain_type_id' => ['type' => 'biginteger', 'length' => 20, 'unsigned' => true, 'null' => false, 'default' => '1', 'comment' => '', 'precision' => null, 'autoIncrement' => null], '_constraints' => [ 'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []], ], '_options' => [ 'engine' => 'InnoDB', - 'collation' => 'utf8_bin' + 'collation' => 'utf8mb4_unicode_ci' ], ]; // @codingStandardsIgnoreEnd @@ -36,44 +38,17 @@ class TransactionsFixture extends TestFixture */ public function init() { - // (1, NULL, 1, 0x7dc55cf3a1a39b441d87d5452c40cad8e7fd8aab573ed1da0bf118129fc77987, 'AGE Dezember 2020', '2021-02-19 13:18:52'), - // (2, NULL, 1, 0xdea38d4dd72af1e0d90621ae8139efbbdb3b44b60be04b0d40cfc157afd2c19c, 'AGE Januar 2021', '2021-02-19 13:25:36'), - // (3, NULL, 1, 0x4e7734ed84dcd8ddc5286b87ff85eb12704092d51f485e7c4dbcb4a68ba296ce, 'AGE Februar 2021', '2021-02-19 13:25:37'), - // (4, NULL, 2, 0x065b5b75b7f4b156fe2b07b54b1a3df0c4eadc40c0f6940c666fed4d75751f8f, 'Ich teile mit dir\r\n \r\nmiau _=', '2021-02-19 13:27:14'); - $this->records = [ - [ - 'id' => 1, - 'group_id' => NULL, - 'transaction_type_id' => 1, - 'tx_hash' => '0x7dc55cf3a1a39b441d87d5452c40cad8e7fd8aab573ed1da0bf118129fc77987', - 'memo' => 'AGE Dezember 2020', - 'received' => '2021-02-19 13:18:52' - ], - [ - 'id' => 2, - 'group_id' => NULL, - 'transaction_type_id' => 1, - 'tx_hash' => '0xdea38d4dd72af1e0d90621ae8139efbbdb3b44b60be04b0d40cfc157afd2c19c', - 'memo' => 'AGE Januar 2021', - 'received' => '2021-02-19 13:25:36' - ], - [ - 'id' => 3, - 'group_id' => NULL, - 'transaction_type_id' => 1, - 'tx_hash' => '0x4e7734ed84dcd8ddc5286b87ff85eb12704092d51f485e7c4dbcb4a68ba296ce', - 'memo' => 'AGE Februar 2021', - 'received' => '2021-02-19 13:25:37' - ], - [ - 'id' => 4, - 'group_id' => NULL, - 'transaction_type_id' => 2, - 'tx_hash' => '0x065b5b75b7f4b156fe2b07b54b1a3df0c4eadc40c0f6940c666fed4d75751f8f', - 'memo' => 'Ich teile mit dir\r\n \r\nmiau _=', - 'received' => '2021-02-19 13:27:14' - ], + $sql = [ + [1, NULL, 1, 0x15f242a7bb92a7db82678e0baf5ec1734c038ac0dc7b19e6d1ebbcf92a6cf3ad00000000000000000000000000000000, 'AGE Januar 2021', '2021-04-09 00:00:00', 1], + [2, NULL, 1, 0xf932eca7686802d1697773fea713a3c6a3e3dace8b5aa552dd8503d50ce349f500000000000000000000000000000000, 'AGE Januar 2021', '2021-04-12 00:00:00', 1], + [3, NULL, 2, 0x4e2235f208edaf5cbb285955732022a625cf1e100eb629c56896d2fbfb8b34e800000000000000000000000000000000, 'test', '2021-04-12 00:00:00', 1], + [4, NULL, 2, 0xfc6e69696beb7c56ad7c511fc3999f954411427bec810184b70c092911deae1900000000000000000000000000000000, 'test time', '2021-04-14 00:00:00', 1], + [5, NULL, 2, 0xa7149ebc0d6cd8c061906dafe05e13689b51642a41100d0ec7bb6cd2dcafdc1800000000000000000000000000000000, 'test time', '2021-04-14 09:01:07', 1], + [6, NULL, 2, 0x2e3c3ab3e42c06f2ecb12f61c970712467d8ad9ddfa16fa58dd76492e5924b7d00000000000000000000000000000000, 'test time 3', '2021-04-14 09:02:28', 1], + [7, NULL, 2, 0xc2c6354d77ff371daeee25fce9c947748b53d3d6b8398a92bd681923cfd2057100000000000000000000000000000000, 'test login crash', '2021-04-14 09:28:46', 1], + [8, NULL, 2, 0x5a8cbf1aaac06b00b2951ff39983cb2ca9a1e6710d72c8e5067278dc679a823100000000000000000000000000000000, 'test login crash', '2021-04-14 09:31:28', 1] ]; + $this->records = $this->sqlEntrysToRecords($sql, $this->fields); parent::init(); } }