Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8439361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:59:29+00:00 2026-06-10T07:59:29+00:00

i keep fixtures in: app/test/fixture/ directory and for e.x. app/test/fixture/UserRoleHistoryFixture.php looks this way <?php

  • 0

i keep fixtures in: app/test/fixture/ directory

and for e.x.
app/test/fixture/UserRoleHistoryFixture.php looks this way

<?php

 class UserRoleHistoryFixture extends CakeTestFixture {
    public $import = array('model' => 'UserRoleHistory', 'records' => false, 'connection' => 'test');
}

app/Test/Fixture/UserFixture.php looks this way

 class UserFixture extends CakeTestFixture {
    public $import = array('model' => 'User', 'records' => true, 'connection' => 'test');
}

All fixtures looks this (only difference is somtimes records are set true)
Then in my UserTest.php(model) im using its this way:

class UserTest extends CakeTestCase {
public $fixtures = array('app.user', 'app.user_role','app.session', 'app.users_activity', 'app.user_role_history'
    );
 public $autoFixtures = false;
 public function setUp() {
    parent::setUp();


    $this->loadFixtures('User','UserRoleHistory','Session','UserRole','UsersActivity');
));

And what i get while trying to do some test i PDO error and stack trace , mayby i called sth wrong way ? Guess that it’s problem with how i make my fixture but dont know ..
Thanks for ideas !

Edit:
my problem changed a little, there is error and stack trace:

PDOException: SQLSTATE[23503]: Foreign key violation: 7 BŁĄD: modyfikacja lub usunięcie     na tabeli "users" narusza klucz obcy "user_role_history_user_id" tabeli "user_role_history"      DETAIL: Klucz (id)=(26381) ma wciąż odwołanie w tabeli "user_role_history".
Test case: UserTest(testUserNameExists)
Stack trace:
C:\Program Files (x86)\PostgreSQL\EnterpriseDB-    ApachePHP\apache\www\soig\www\konkursy2.0\lib\Cake\Model\Datasource\DboSource.php : 436
C:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\soig\www\konkursy2.0\lib\Cake\Model\Datasource\DboSource.php : 403
C:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\soig\www\konkursy2.0\lib\Cake\Model\Datasource\Database\Postgres.php : 309
C:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\soig\www\konkursy2.0\lib\Cake\TestSuite\Fixture\CakeTestFixture.php : 232
C:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\soig\www\konkursy2.0\lib\Cake\TestSuite\Fixture\CakeFixtureManager.php : 236
C:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\soig\www\konkursy2.0\lib\Cake\TestSuite\CakeTestCase.php : 191
C:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\soig\www\konkursy2.0\app\Test\Case\Model\UserTest.php : 16
C:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\soig\www\konkursy2.0\vendors\PHPUnit\Framework\TestCase.php : 801
C:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\soig\www\konkursy2.0\app\webroot\test.php : 92

Also what i got is

 Fatal Error (256): [PDOException] You cannot serialize or unserialize PDOStatement  instances
 #0 [internal function]: PDOStatement->__sleep()
 etc ;/

i see the first problem is about foregin key, and that when test is used to delete table users there is foregin key violation but is it problem about how the database is created ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:59:31+00:00Added an answer on June 10, 2026 at 7:59 am

    You importing from ‘test’ datasource, remove that in your fixtures. it pull from default, or specify another to pull from if you like. It will create in ‘test’ instead of importing from it

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this error when I try to run my TypeScript app: Should
(Keep in mind this is on OSX Snow Leopard) I don't know how to
Keep getting this error after inserting a subdatasheet into a query and trying to
Keep going around circles, but I am still unclear about this. Have a feeling
I keep getting an error saying that @android:style/Widget.Holo.Light.Button.Borderless is not public and so can't
I keep coming back to this problem, since there doesn't seem to be a
I keep getting this error and have no idea why. I googled and scanned
I'm trying to create a test fixture using Fitnesse framework, and I want to
Keep only ObservableCollections in the ViewModel and IEnumerables in the Model? Does following this
Keep getting these errors while trying to compile an c++ class program. testStock.cpp: In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.