From e28feac3adaeff468e73cea6c5be00d3c162cec0 Mon Sep 17 00:00:00 2001 From: Marcin Gil Date: Mon, 13 Mar 2023 22:06:23 +0100 Subject: [PATCH 1/3] commit of failing test for the issue encountered --- tests/Ticket/OV25TestCase.php | 141 ++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 tests/Ticket/OV25TestCase.php diff --git a/tests/Ticket/OV25TestCase.php b/tests/Ticket/OV25TestCase.php new file mode 100644 index 000000000..fb2efa9d2 --- /dev/null +++ b/tests/Ticket/OV25TestCase.php @@ -0,0 +1,141 @@ +. + */ + +/** + * Doctrine_Ticket_OV25_TestCase + * + * Collection::isModified, getDeleteDiff, getInsertDiff + * + * @package Doctrine + * @author Konsta Vesterinen + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.doctrine-project.org + * @since 1.0 + * @version $Revision$ + */ +class Doctrine_Ticket_OV25_TestCase extends Doctrine_UnitTestCase +{ + public function prepareTables() + { + $this->tables[] = 'Ticket_OV1_User'; + $this->tables[] = 'Ticket_OV1_Role'; + $this->tables[] = 'Ticket_OV1_UserRole'; + $this->tables[] = 'Ticket_OV1_RoleReference'; + parent::prepareTables(); + } + + public function prepareData() + { + $user = new Ticket_OV1_User(); + $user->username = 'username'; + $user->password = 'password'; + $user->save(); + + $role = new Ticket_OV1_Role(); + $role->name = 'admin'; + $role->save(); + + $role = new Ticket_OV1_Role(); + $role->name = 'photographer'; + $role->save(); + + $userRole = new Ticket_OV1_UserRole(); + $userRole->id_user = $user->id; + $userRole->id_role = $role->id; + $userRole->position = 1; + $userRole->save(); + + $user->free(); + $role->free(); + $userRole->free(); + } + + public function testTest() + { + $user = Doctrine_Core::getTable('Ticket_OV1_User')->find(1); + $user->fromArray(array('Roles' => array(1, 2))); + $this->assertTrue($user->Roles->isModified()); + } +} + +class Ticket_OV25_User extends Doctrine_Record +{ + public function setTableDefinition() + { + $this->hasColumn('username', 'string', 64, array('notnull' => true)); + $this->hasColumn('password', 'string', 128, array('notnull' => true)); + } + + public function setUp() + { + $this->hasMany('Ticket_OV1_Role as Roles', array('local' => 'id_user', 'foreign' => 'id_role', 'refClass' => 'Ticket_OV1_UserRole', 'refOrderBy' => 'position ASC')); + } +} + +class Ticket_OV25_Role extends Doctrine_Record +{ + public function setTableDefinition() + { + $this->hasColumn('name', 'string', 64); + } + + public function setUp() + { + $this->hasMany('Ticket_OV1_User as Users', array('local' => 'id_role', 'foreign' => 'id_user', 'refClass' => 'Ticket_OV1_UserRole', 'orderBy' => 'username DESC')); + $this->hasMany('Ticket_OV1_Role as Parents', array('local' => 'id_role_child', 'foreign' => 'id_role_parent', 'refClass' => 'Ticket_OV1_RoleReference')); + $this->hasMany('Ticket_OV1_Role as Children', array('local' => 'id_role_parent', 'foreign' => 'id_role_child', 'refClass' => 'Ticket_OV1_RoleReference')); + } +} + +class Ticket_OV25_UserRole extends Doctrine_Record +{ + public function setTableDefinition() + { + $this->hasColumn('id_user', 'integer', null, array('primary' => true)); + $this->hasColumn('id_role', 'integer', null, array('primary' => true)); + $this->hasColumn('position', 'integer', null, array('notnull' => true)); + } + + public function setUp() + { + $this->hasOne('Ticket_OV1_User as User', array('local' => 'id_user', 'foreign' => 'id', 'onDelete' => 'CASCADE')); + $this->hasOne('Ticket_OV1_Role as Role', array('local' => 'id_role', 'foreign' => 'id', 'onDelete' => 'CASCADE')); + } +} + +class Ticket_OV25_RoleReference extends Doctrine_Record +{ + public function setTableDefinition() + { + $this->hasColumn('id_role_parent', 'integer', null, array('primary' => true)); + $this->hasColumn('id_role_child', 'integer', null, array('primary' => true)); + $this->hasColumn('position', 'integer', null, array('notnull' => true)); + + $this->option('orderBy', 'position DESC'); + } + + public function setUp() + { + $this->hasOne('Ticket_OV1_Role as Parent', array('local' => 'id_role_parent', 'foreign' => 'id', 'onDelete' => 'CASCADE')); + $this->hasOne('Ticket_OV1_Role as Child', array('local' => 'id_role_child', 'foreign' => 'id', 'onDelete' => 'CASCADE')); + } +} \ No newline at end of file From 4269ee4720d3f80361d39b418c34ef251827bffd Mon Sep 17 00:00:00 2001 From: Marcin Gil Date: Wed, 31 Jan 2024 16:38:08 +0100 Subject: [PATCH 2/3] updated tests.yml - enabled JIT --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 82e635605..0d225af58 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,7 +23,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - ini-values: apc.enable_cli=1 + ini-values: apc.enable_cli=1, opcache.enable=1, opcache.enable_cli=1, opcache.jit=tracing, opcache.jit_buffer_size=128M env: fail-fast: true From 2f7585d83d0fa010f3747ad3d7cdeef5c71a0dcc Mon Sep 17 00:00:00 2001 From: Marcin Gil Date: Wed, 31 Jan 2024 17:08:35 +0100 Subject: [PATCH 3/3] fixed Ticket_OV25 --- tests/Ticket/OV25TestCase.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/Ticket/OV25TestCase.php b/tests/Ticket/OV25TestCase.php index fb2efa9d2..3b5bc8729 100644 --- a/tests/Ticket/OV25TestCase.php +++ b/tests/Ticket/OV25TestCase.php @@ -36,29 +36,29 @@ class Doctrine_Ticket_OV25_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { - $this->tables[] = 'Ticket_OV1_User'; - $this->tables[] = 'Ticket_OV1_Role'; - $this->tables[] = 'Ticket_OV1_UserRole'; - $this->tables[] = 'Ticket_OV1_RoleReference'; + $this->tables[] = 'Ticket_OV25_User'; + $this->tables[] = 'Ticket_OV25_Role'; + $this->tables[] = 'Ticket_OV25_UserRole'; + $this->tables[] = 'Ticket_OV25_RoleReference'; parent::prepareTables(); } public function prepareData() { - $user = new Ticket_OV1_User(); + $user = new Ticket_OV25_User(); $user->username = 'username'; $user->password = 'password'; $user->save(); - $role = new Ticket_OV1_Role(); + $role = new Ticket_OV25_Role(); $role->name = 'admin'; $role->save(); - $role = new Ticket_OV1_Role(); + $role = new Ticket_OV25_Role(); $role->name = 'photographer'; $role->save(); - $userRole = new Ticket_OV1_UserRole(); + $userRole = new Ticket_OV25_UserRole(); $userRole->id_user = $user->id; $userRole->id_role = $role->id; $userRole->position = 1; @@ -71,7 +71,7 @@ public function prepareData() public function testTest() { - $user = Doctrine_Core::getTable('Ticket_OV1_User')->find(1); + $user = Doctrine_Core::getTable('Ticket_OV25_User')->find(1); $user->fromArray(array('Roles' => array(1, 2))); $this->assertTrue($user->Roles->isModified()); } @@ -87,7 +87,7 @@ public function setTableDefinition() public function setUp() { - $this->hasMany('Ticket_OV1_Role as Roles', array('local' => 'id_user', 'foreign' => 'id_role', 'refClass' => 'Ticket_OV1_UserRole', 'refOrderBy' => 'position ASC')); + $this->hasMany('Ticket_OV25_Role as Roles', array('local' => 'id_user', 'foreign' => 'id_role', 'refClass' => 'Ticket_OV25_UserRole', 'refOrderBy' => 'position ASC')); } } @@ -100,9 +100,9 @@ public function setTableDefinition() public function setUp() { - $this->hasMany('Ticket_OV1_User as Users', array('local' => 'id_role', 'foreign' => 'id_user', 'refClass' => 'Ticket_OV1_UserRole', 'orderBy' => 'username DESC')); - $this->hasMany('Ticket_OV1_Role as Parents', array('local' => 'id_role_child', 'foreign' => 'id_role_parent', 'refClass' => 'Ticket_OV1_RoleReference')); - $this->hasMany('Ticket_OV1_Role as Children', array('local' => 'id_role_parent', 'foreign' => 'id_role_child', 'refClass' => 'Ticket_OV1_RoleReference')); + $this->hasMany('Ticket_OV25_User as Users', array('local' => 'id_role', 'foreign' => 'id_user', 'refClass' => 'Ticket_OV25_UserRole', 'orderBy' => 'username DESC')); + $this->hasMany('Ticket_OV25_Role as Parents', array('local' => 'id_role_child', 'foreign' => 'id_role_parent', 'refClass' => 'Ticket_OV25_RoleReference')); + $this->hasMany('Ticket_OV25_Role as Children', array('local' => 'id_role_parent', 'foreign' => 'id_role_child', 'refClass' => 'Ticket_OV25_RoleReference')); } } @@ -117,8 +117,8 @@ public function setTableDefinition() public function setUp() { - $this->hasOne('Ticket_OV1_User as User', array('local' => 'id_user', 'foreign' => 'id', 'onDelete' => 'CASCADE')); - $this->hasOne('Ticket_OV1_Role as Role', array('local' => 'id_role', 'foreign' => 'id', 'onDelete' => 'CASCADE')); + $this->hasOne('Ticket_OV25_User as User', array('local' => 'id_user', 'foreign' => 'id', 'onDelete' => 'CASCADE')); + $this->hasOne('Ticket_OV25_Role as Role', array('local' => 'id_role', 'foreign' => 'id', 'onDelete' => 'CASCADE')); } } @@ -135,7 +135,7 @@ public function setTableDefinition() public function setUp() { - $this->hasOne('Ticket_OV1_Role as Parent', array('local' => 'id_role_parent', 'foreign' => 'id', 'onDelete' => 'CASCADE')); - $this->hasOne('Ticket_OV1_Role as Child', array('local' => 'id_role_child', 'foreign' => 'id', 'onDelete' => 'CASCADE')); + $this->hasOne('Ticket_OV25_Role as Parent', array('local' => 'id_role_parent', 'foreign' => 'id', 'onDelete' => 'CASCADE')); + $this->hasOne('Ticket_OV25_Role as Child', array('local' => 'id_role_child', 'foreign' => 'id', 'onDelete' => 'CASCADE')); } } \ No newline at end of file