mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #8207 from CakeDC/feature/uuid
Add support for Postgres native uuid datatype
This commit is contained in:
commit
68082fad02
13 changed files with 540 additions and 8 deletions
|
@ -68,7 +68,8 @@ class Postgres extends DboSource {
|
|||
'binary' => array('name' => 'bytea'),
|
||||
'boolean' => array('name' => 'boolean'),
|
||||
'number' => array('name' => 'numeric'),
|
||||
'inet' => array('name' => 'inet')
|
||||
'inet' => array('name' => 'inet'),
|
||||
'uuid' => array('name' => 'uuid')
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -216,6 +217,7 @@ class Postgres extends DboSource {
|
|||
$length = null;
|
||||
$type = 'text';
|
||||
} elseif ($c->type === 'uuid') {
|
||||
$type = 'uuid';
|
||||
$length = 36;
|
||||
} else {
|
||||
$length = (int)$c->oct_length;
|
||||
|
@ -241,7 +243,10 @@ class Postgres extends DboSource {
|
|||
if ($model instanceof Model) {
|
||||
if ($c->name === $model->primaryKey) {
|
||||
$fields[$c->name]['key'] = 'primary';
|
||||
if ($fields[$c->name]['type'] !== 'string') {
|
||||
if (
|
||||
$fields[$c->name]['type'] !== 'string' &&
|
||||
$fields[$c->name]['type'] !== 'uuid'
|
||||
) {
|
||||
$fields[$c->name]['length'] = 11;
|
||||
}
|
||||
}
|
||||
|
@ -698,8 +703,10 @@ class Postgres extends DboSource {
|
|||
return 'biginteger';
|
||||
case (strpos($col, 'int') !== false && $col !== 'interval'):
|
||||
return 'integer';
|
||||
case (strpos($col, 'char') !== false || $col === 'uuid'):
|
||||
case (strpos($col, 'char') !== false):
|
||||
return 'string';
|
||||
case (strpos($col, 'uuid') !== false):
|
||||
return 'uuid';
|
||||
case (strpos($col, 'text') !== false):
|
||||
return 'text';
|
||||
case (strpos($col, 'bytea') !== false):
|
||||
|
@ -922,6 +929,17 @@ class Postgres extends DboSource {
|
|||
return $join;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function value($data, $column = null, $null = true) {
|
||||
$value = parent::value($data, $column, $null);
|
||||
if ($column === 'uuid' && is_scalar($data) && $data === '') {
|
||||
return 'NULL';
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides DboSource::renderStatement to handle schema generation with Postgres-style indexes
|
||||
*
|
||||
|
|
|
@ -1982,7 +1982,7 @@ class Model extends Object implements CakeEventListener {
|
|||
*/
|
||||
protected function _isUUIDField($field) {
|
||||
$field = $this->schema($field);
|
||||
return $field['length'] == 36 && in_array($field['type'], array('string', 'binary'));
|
||||
return $field['length'] == 36 && in_array($field['type'], array('string', 'binary', 'uuid'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -132,7 +132,8 @@ class PostgresTestModel extends Model {
|
|||
'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
|
||||
'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
||||
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
||||
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null),
|
||||
'some_uuid' => array('type' => 'uuid', 'null' => '1', 'default' => null),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -257,7 +258,8 @@ class PostgresTest extends CakeTestCase {
|
|||
'"PostgresTestModel"."comments" AS "PostgresTestModel__comments"',
|
||||
'"PostgresTestModel"."last_login" AS "PostgresTestModel__last_login"',
|
||||
'"PostgresTestModel"."created" AS "PostgresTestModel__created"',
|
||||
'"PostgresTestModel"."updated" AS "PostgresTestModel__updated"'
|
||||
'"PostgresTestModel"."updated" AS "PostgresTestModel__updated"',
|
||||
'"PostgresTestModel"."some_uuid" AS "PostgresTestModel__some_uuid"'
|
||||
);
|
||||
|
||||
$result = $this->Dbo->fields($this->model);
|
||||
|
@ -300,6 +302,7 @@ class PostgresTest extends CakeTestCase {
|
|||
$this->assertEquals('decimal', $this->Dbo2->column('numeric'));
|
||||
$this->assertEquals('float', $this->Dbo2->column('float'));
|
||||
$this->assertEquals('float', $this->Dbo2->column('double precision'));
|
||||
$this->assertEquals('uuid', $this->Dbo2->column('uuid'));
|
||||
|
||||
$result = $this->Dbo2->column('bigint');
|
||||
$expected = 'biginteger';
|
||||
|
@ -336,6 +339,8 @@ class PostgresTest extends CakeTestCase {
|
|||
$this->assertEquals("'TRUE'", $this->Dbo->value('1', 'boolean'));
|
||||
$this->assertEquals("NULL", $this->Dbo->value(null, 'boolean'));
|
||||
$this->assertEquals("NULL", $this->Dbo->value(array()));
|
||||
$this->assertEquals("'550e8400-e29b-41d4-a716-446655440000'", $this->Dbo->value('550e8400-e29b-41d4-a716-446655440000', 'uuid'));
|
||||
$this->assertEquals("NULL", $this->Dbo->value(null, 'uuid'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1150,7 +1155,7 @@ class PostgresTest extends CakeTestCase {
|
|||
$data = $db->describe('test_uuid_describe');
|
||||
|
||||
$expected = array(
|
||||
'type' => 'string',
|
||||
'type' => 'uuid',
|
||||
'null' => false,
|
||||
'default' => null,
|
||||
'length' => 36,
|
||||
|
@ -1204,4 +1209,13 @@ class PostgresTest extends CakeTestCase {
|
|||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test build column working for new uuid types
|
||||
*/
|
||||
public function testBuildColumnUuid() {
|
||||
$column = array('name' => 'col1', 'type' => 'uuid');
|
||||
$result = $this->Dbo2->buildColumn($column);
|
||||
|
||||
$this->assertEquals('"col1" uuid', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ abstract class BaseModelTest extends CakeTestCase {
|
|||
'core.feature_set', 'core.exterior_type_category', 'core.document', 'core.device',
|
||||
'core.document_directory', 'core.primary_model', 'core.secondary_model', 'core.something',
|
||||
'core.something_else', 'core.join_thing', 'core.join_a', 'core.join_b', 'core.join_c',
|
||||
'core.join_a_b', 'core.join_a_c', 'core.uuid', 'core.data_test', 'core.posts_tag',
|
||||
'core.join_a_b', 'core.join_a_c', 'core.uuid', 'core.uuid_native', 'core.data_test', 'core.posts_tag',
|
||||
'core.the_paper_monkies', 'core.person', 'core.underscore_field', 'core.node',
|
||||
'core.dependency', 'core.story', 'core.stories_tag', 'core.cd', 'core.book', 'core.basket',
|
||||
'core.overall_favorite', 'core.account', 'core.content', 'core.content_account',
|
||||
|
@ -71,6 +71,8 @@ abstract class BaseModelTest extends CakeTestCase {
|
|||
'core.fruits_uuid_tag', 'core.uuid_tag', 'core.product_update_all', 'core.group_update_all',
|
||||
'core.player', 'core.guild', 'core.guilds_player', 'core.armor', 'core.armors_player',
|
||||
'core.bidding', 'core.bidding_message', 'core.site', 'core.domain', 'core.domains_site',
|
||||
'core.uuidnativeitem', 'core.uuidnativeportfolio', 'core.uuidnativeitems_uuidnativeportfolio',
|
||||
'core.uuidnativeitems_uuidnativeportfolio_numericid',
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -270,6 +270,26 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$this->assertEquals(36, strlen($result['Uuid']['id']));
|
||||
}
|
||||
|
||||
/**
|
||||
* testAutoSaveUuidNative method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAutoSaveUuidNative() {
|
||||
$this->skipIf(!($this->db instanceof Postgres), 'This test is compatible with Postgres only.');
|
||||
|
||||
$this->loadFixtures('UuidNative');
|
||||
$TestModel = new UuidNative();
|
||||
|
||||
$TestModel->save(array('title' => 'Test record'));
|
||||
$result = $TestModel->findByTitle('Test record');
|
||||
$this->assertEquals(
|
||||
array('id', 'title', 'count', 'created', 'updated'),
|
||||
array_keys($result['UuidNative'])
|
||||
);
|
||||
$this->assertEquals(36, strlen($result['UuidNative']['id']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that if the id key is null but present the save doesn't fail (with an
|
||||
* x sql error: "Column id specified twice")
|
||||
|
@ -292,6 +312,27 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$this->assertEquals(36, strlen($result['Uuid']['id']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that if the id key is null but present the save doesn't fail (with an
|
||||
* x sql error: "Column id specified twice")
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSaveUuidNullNative() {
|
||||
$this->skipIf(!($this->db instanceof Postgres), 'This test is compatible with Postgres only.');
|
||||
|
||||
$this->loadFixtures('UuidNative');
|
||||
$TestModel = new UuidNative();
|
||||
|
||||
$TestModel->save(array('title' => 'Test record', 'id' => null));
|
||||
$result = $TestModel->findByTitle('Test record');
|
||||
$this->assertEquals(
|
||||
array('id', 'title', 'count', 'created', 'updated'),
|
||||
array_keys($result['UuidNative'])
|
||||
);
|
||||
$this->assertEquals(36, strlen($result['UuidNative']['id']));
|
||||
}
|
||||
|
||||
/**
|
||||
* testZeroDefaultFieldValue method
|
||||
*
|
||||
|
@ -2938,6 +2979,26 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$this->assertEquals(36, strlen($result['Uuiditem'][0]['UuiditemsUuidportfolio']['id']));
|
||||
}
|
||||
|
||||
/**
|
||||
* testHabtmUuidWithUuidId method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testHabtmUuidWithUuidIdNative() {
|
||||
$this->skipIf(!($this->db instanceof Postgres), 'This test is compatible with Postgres only.');
|
||||
$this->loadFixtures('Uuidnativeportfolio', 'Uuidnativeitem', 'UuidnativeitemsUuidnativeportfolio', 'UuidnativeitemsUuidnativeportfolioNumericid');
|
||||
$TestModel = new Uuidnativeportfolio();
|
||||
|
||||
$data = array('Uuidnativeportfolio' => array('name' => 'Portfolio 3'));
|
||||
$data['Uuidnativeitem']['Uuidnativeitem'] = array('483798c8-c7cc-430e-8cf9-4fcc40cf8569');
|
||||
$TestModel->create($data);
|
||||
$TestModel->save();
|
||||
$id = $TestModel->id;
|
||||
$result = $TestModel->read(null, $id);
|
||||
$this->assertEquals(1, count($result['Uuidnativeitem']));
|
||||
$this->assertEquals(36, strlen($result['Uuidnativeitem'][0]['UuidnativeitemsUuidnativeportfolio']['id']));
|
||||
}
|
||||
|
||||
/**
|
||||
* test HABTM saving when join table has no primary key and only 2 columns.
|
||||
*
|
||||
|
@ -3007,6 +3068,25 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$this->assertEquals(1, count($result['Uuidportfolio']));
|
||||
}
|
||||
|
||||
/**
|
||||
* testHabtmUuidWithNumericId method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testHabtmUuidWithNumericIdNative() {
|
||||
$this->skipIf(!($this->db instanceof Postgres), 'This test is compatible with Postgres only.');
|
||||
$this->loadFixtures('Uuidnativeportfolio', 'Uuidnativeitem', 'UuidnativeitemsUuidnativeportfolioNumericid');
|
||||
$TestModel = new Uuidnativeitem();
|
||||
|
||||
$data = array('Uuidnativeitem' => array('name' => 'Item 7', 'published' => 0));
|
||||
$data['Uuidnativeportfolio']['Uuidnativeportfolio'] = array('480af662-eb8c-47d3-886b-230540cf8569');
|
||||
$TestModel->create($data);
|
||||
$TestModel->save();
|
||||
$id = $TestModel->id;
|
||||
$result = $TestModel->read(null, $id);
|
||||
$this->assertEquals(1, count($result['Uuidnativeportfolio']));
|
||||
}
|
||||
|
||||
/**
|
||||
* testSaveMultipleHabtm method
|
||||
*
|
||||
|
|
|
@ -2120,6 +2120,21 @@ class Uuid extends CakeTestModel {
|
|||
public $name = 'Uuid';
|
||||
}
|
||||
|
||||
/**
|
||||
* UuidNative class
|
||||
*
|
||||
* @package Cake.Test.Case.Model
|
||||
*/
|
||||
class UuidNative extends CakeTestModel {
|
||||
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name = 'UuidNative';
|
||||
}
|
||||
|
||||
/**
|
||||
* DataTest class
|
||||
*
|
||||
|
@ -3055,6 +3070,84 @@ class UuiditemsUuidportfolioNumericid extends CakeTestModel {
|
|||
public $name = 'UuiditemsUuidportfolioNumericid';
|
||||
}
|
||||
|
||||
/**
|
||||
* Uuidnativeportfolio class
|
||||
*
|
||||
* @package Cake.Test.Case.Model
|
||||
*/
|
||||
class Uuidnativeportfolio extends CakeTestModel {
|
||||
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name = 'Uuidnativeportfolio';
|
||||
|
||||
/**
|
||||
* hasAndBelongsToMany property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $hasAndBelongsToMany = array('Uuidnativeitem');
|
||||
}
|
||||
|
||||
/**
|
||||
* Uuidnativeitem class
|
||||
*
|
||||
* @package Cake.Test.Case.Model
|
||||
*/
|
||||
class Uuidnativeitem extends CakeTestModel {
|
||||
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name = 'Uuidnativeitem';
|
||||
|
||||
/**
|
||||
* hasAndBelongsToMany property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $hasAndBelongsToMany = array(
|
||||
'Uuidnativeportfolio' => array(
|
||||
'with' => 'UuidnativeitemsUuidnativeportfolioNumericid'
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* UuidnativeitemsUuidnativeportfolio class
|
||||
*
|
||||
* @package Cake.Test.Case.Model
|
||||
*/
|
||||
class UuidnativeitemsUuidnativeportfolio extends CakeTestModel {
|
||||
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name = 'UuidnativeitemsUuidnativeportfolio';
|
||||
}
|
||||
|
||||
/**
|
||||
* UuidnativeitemsPortfolioNumericid class
|
||||
*
|
||||
* @package Cake.Test.Case.Model
|
||||
*/
|
||||
class UuidnativeitemsUuidnativeportfolioNumericid extends CakeTestModel {
|
||||
|
||||
/**
|
||||
* name property
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name = 'UuidnativeitemsUuidnativeportfolioNumericid';
|
||||
}
|
||||
|
||||
/**
|
||||
* TranslateTestModel class.
|
||||
*
|
||||
|
|
50
lib/Cake/Test/Fixture/UuidNativeFixture.php
Normal file
50
lib/Cake/Test/Fixture/UuidNativeFixture.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||||
* @package Cake.Test.Fixture
|
||||
* @since CakePHP(tm) v 1.2.0.6700
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class UuidNativeFixture.
|
||||
*
|
||||
* @package Cake.Test.Fixture
|
||||
*/
|
||||
class UuidNativeFixture extends CakeTestFixture {
|
||||
|
||||
/**
|
||||
* fields property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $fields = array(
|
||||
'id' => array('type' => 'uuid', 'key' => 'primary'),
|
||||
'title' => 'string',
|
||||
'count' => array('type' => 'integer', 'default' => 0),
|
||||
'created' => 'datetime',
|
||||
'updated' => 'datetime'
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $records = array(
|
||||
array('id' => '47c36f9c-bc00-4d17-9626-4e183ca6822b', 'title' => 'Unique record 1', 'count' => 2, 'created' => '2008-03-13 01:16:23', 'updated' => '2008-03-13 01:18:31'),
|
||||
array('id' => '47c36f9c-f2b0-43f5-b3f7-4e183ca6822b', 'title' => 'Unique record 2', 'count' => 4, 'created' => '2008-03-13 01:18:24', 'updated' => '2008-03-13 01:20:32'),
|
||||
array('id' => '47c36f9c-0ffc-4084-9b03-4e183ca6822b', 'title' => 'Unique record 3', 'count' => 5, 'created' => '2008-03-13 01:20:25', 'updated' => '2008-03-13 01:22:33'),
|
||||
array('id' => '47c36f9c-2578-4c2e-aeab-4e183ca6822b', 'title' => 'Unique record 4', 'count' => 3, 'created' => '2008-03-13 01:22:26', 'updated' => '2008-03-13 01:24:34'),
|
||||
);
|
||||
}
|
45
lib/Cake/Test/Fixture/UuidNativeTagFixture.php
Normal file
45
lib/Cake/Test/Fixture/UuidNativeTagFixture.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||||
* @package Cake.Test.Fixture
|
||||
* @since CakePHP(tm) v 1.2.0.7953
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class UuidNativeTagFixture
|
||||
*
|
||||
* @package Cake.Test.Fixture
|
||||
*/
|
||||
class UuidNativeTagFixture extends CakeTestFixture {
|
||||
|
||||
/**
|
||||
* fields property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $fields = array(
|
||||
'id' => array('type' => 'uuid', 'key' => 'primary'),
|
||||
'name' => array('type' => 'string', 'length' => 255),
|
||||
'created' => array('type' => 'datetime')
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $records = array(
|
||||
array('id' => '481fc6d0-b920-43e0-e50f-6d1740cf8569', 'name' => 'MyTag', 'created' => '2009-12-09 12:30:00')
|
||||
);
|
||||
}
|
39
lib/Cake/Test/Fixture/UuidNativeTreeFixture.php
Normal file
39
lib/Cake/Test/Fixture/UuidNativeTreeFixture.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* UUID Tree behavior fixture.
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||||
* @package Cake.Test.Fixture
|
||||
* @since CakePHP(tm) v 1.2.0.7984
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* UuidNativeTreeFixture class
|
||||
*
|
||||
* @uses CakeTestFixture
|
||||
* @package Cake.Test.Fixture
|
||||
*/
|
||||
class UuidNativeTreeFixture extends CakeTestFixture {
|
||||
|
||||
/**
|
||||
* fields property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $fields = array(
|
||||
'id' => array('type' => 'uuid', 'key' => 'primary'),
|
||||
'name' => array('type' => 'string', 'null' => false),
|
||||
'parent_id' => array('type' => 'string', 'length' => 36, 'null' => true),
|
||||
'lft' => array('type' => 'integer', 'null' => false),
|
||||
'rght' => array('type' => 'integer', 'null' => false)
|
||||
);
|
||||
}
|
50
lib/Cake/Test/Fixture/UuidnativeitemFixture.php
Normal file
50
lib/Cake/Test/Fixture/UuidnativeitemFixture.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||||
* @package Cake.Test.Fixture
|
||||
* @since CakePHP(tm) v 1.2.0.4667
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class UuidnativeitemFixture
|
||||
*
|
||||
* @package Cake.Test.Fixture
|
||||
*/
|
||||
class UuidnativeitemFixture extends CakeTestFixture {
|
||||
|
||||
/**
|
||||
* fields property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $fields = array(
|
||||
'id' => array('type' => 'uuid', 'key' => 'primary'),
|
||||
'published' => array('type' => 'boolean', 'null' => false),
|
||||
'name' => array('type' => 'string', 'null' => false)
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $records = array(
|
||||
array('id' => '481fc6d0-b920-43e0-a40d-6d1740cf8569', 'published' => 0, 'name' => 'Item 1'),
|
||||
array('id' => '48298a29-81c0-4c26-a7fb-413140cf8569', 'published' => 0, 'name' => 'Item 2'),
|
||||
array('id' => '482b7756-8da0-419a-b21f-27da40cf8569', 'published' => 0, 'name' => 'Item 3'),
|
||||
array('id' => '482cfd4b-0e7c-4ea3-9582-4cec40cf8569', 'published' => 0, 'name' => 'Item 4'),
|
||||
array('id' => '4831181b-4020-4983-a29b-131440cf8569', 'published' => 0, 'name' => 'Item 5'),
|
||||
array('id' => '483798c8-c7cc-430e-8cf9-4fcc40cf8569', 'published' => 0, 'name' => 'Item 6')
|
||||
);
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||||
* @package Cake.Test.Fixture
|
||||
* @since CakePHP(tm) v 1.2.0.4667
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class UuiditemsUuidportfolioFixture
|
||||
*
|
||||
* @package Cake.Test.Fixture
|
||||
*/
|
||||
class UuidnativeitemsUuidnativeportfolioFixture extends CakeTestFixture {
|
||||
|
||||
/**
|
||||
* fields property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $fields = array(
|
||||
'id' => array('type' => 'uuid', 'key' => 'primary'),
|
||||
'uuidnativeitem_id' => array('type' => 'uuid', 'null' => false),
|
||||
'uuidnativeportfolio_id' => array('type' => 'uuid', 'null' => false)
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $records = array(
|
||||
array('id' => '4850fd8f-cc5c-449f-bf34-0c5240cf8569', 'uuidnativeitem_id' => '481fc6d0-b920-43e0-a40d-6d1740cf8569', 'uuidnativeportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569'),
|
||||
array('id' => '4850fee5-d24c-4ea0-9759-0c2e40cf8569', 'uuidnativeitem_id' => '48298a29-81c0-4c26-a7fb-413140cf8569', 'uuidnativeportfolio_id' => '480af662-eb8c-47d3-886b-230540cf8569'),
|
||||
array('id' => '4851af6e-fa18-403d-b57e-437d40cf8569', 'uuidnativeitem_id' => '482b7756-8da0-419a-b21f-27da40cf8569', 'uuidnativeportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569'),
|
||||
array('id' => '4851b94c-9790-42dc-b760-4f9240cf8569', 'uuidnativeitem_id' => '482cfd4b-0e7c-4ea3-9582-4cec40cf8569', 'uuidnativeportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569')
|
||||
);
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||||
* @package Cake.Test.Fixture
|
||||
* @since CakePHP(tm) v 1.2.0.4667
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class UuidnativeitemsUuidnativeportfolioNumericidFixture
|
||||
*
|
||||
* @package Cake.Test.Fixture
|
||||
*/
|
||||
class UuidnativeitemsUuidnativeportfolioNumericidFixture extends CakeTestFixture {
|
||||
|
||||
/**
|
||||
* fields property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $fields = array(
|
||||
'id' => array('type' => 'integer', 'length' => 10, 'key' => 'primary'),
|
||||
'uuidnativeitem_id' => array('type' => 'uuid', 'null' => false),
|
||||
'uuidnativeportfolio_id' => array('type' => 'uuid', 'null' => false)
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $records = array(
|
||||
array('uuidnativeitem_id' => '481fc6d0-b920-43e0-a40d-6d1740cf8569', 'uuidnativeportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569'),
|
||||
array('uuidnativeitem_id' => '48298a29-81c0-4c26-a7fb-413140cf8569', 'uuidnativeportfolio_id' => '480af662-eb8c-47d3-886b-230540cf8569'),
|
||||
array('uuidnativeitem_id' => '482b7756-8da0-419a-b21f-27da40cf8569', 'uuidnativeportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569'),
|
||||
array('uuidnativeitem_id' => '482cfd4b-0e7c-4ea3-9582-4cec40cf8569', 'uuidnativeportfolio_id' => '4806e091-6940-4d2b-b227-303740cf8569')
|
||||
);
|
||||
}
|
45
lib/Cake/Test/Fixture/UuidnativeportfolioFixture.php
Normal file
45
lib/Cake/Test/Fixture/UuidnativeportfolioFixture.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
|
||||
* @package Cake.Test.Fixture
|
||||
* @since CakePHP(tm) v 1.2.0.4667
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class UuidnativeportfolioFixture
|
||||
*
|
||||
* @package Cake.Test.Fixture
|
||||
*/
|
||||
class UuidnativeportfolioFixture extends CakeTestFixture {
|
||||
|
||||
/**
|
||||
* fields property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $fields = array(
|
||||
'id' => array('type' => 'uuid', 'key' => 'primary'),
|
||||
'name' => array('type' => 'string', 'null' => false)
|
||||
);
|
||||
|
||||
/**
|
||||
* records property
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $records = array(
|
||||
array('id' => '4806e091-6940-4d2b-b227-303740cf8569', 'name' => 'Portfolio 1'),
|
||||
array('id' => '480af662-eb8c-47d3-886b-230540cf8569', 'name' => 'Portfolio 2'),
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue