Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test for issue #657 (calling find before flush) #665

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -881,4 +881,31 @@ public function testAdditionalFindCallsDoNotRefresh()

$this->assertEquals('Guten tag', $trans->topic);
}

/**
* It should be able to find a bound translation before flush.
*/
public function testRetainTranslation()
{
$article = new Article;
$article->id = '/functional/article-1';
$article->text = 'Foo';
$this->dm->persist($article);

$article->topic = 'Hello everybody!';
$this->dm->bindTranslation($article, 'en');

$article->topic = 'Bonjour le monde!';
$this->dm->bindTranslation($article, 'fr');
$articleInstance = $this->dm->findTranslation(get_class($article), '/functional/article-1', 'en');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be the same object as $article. not sure if we should assign in this case. if we have no test about that, maybe assertSame($article, $articleInstance).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was trying to illustrate the problrem, but yeah, pointlesss.

On 9 October 2015 16:45:53 BST, David Buchmann notifications@github.com wrote:

  • /**
  • \* It should be able to find a bound translation before flush.
    
  • */
    
  • public function testRetainTranslation()
  • {
  •    $article = new Article;
    
  •    $article->id = '/functional/article-1';
    
  •    $article->text = 'Foo';
    
  •    $this->dm->persist($article);
    
  •    $article->topic = 'Hello everybody!';
    
  •    $this->dm->bindTranslation($article, 'en');
    
  •    $article->topic = 'Bonjour le monde!';
    
  •    $this->dm->bindTranslation($article, 'fr');
    
  •    $articleInstance =
    
    $this->dm->findTranslation(get_class($article),
    '/functional/article-1', 'en');

this will be the same object as $article. not sure if we should assign
in this case. if we have no test about that, maybe assertSame($article,
$articleInstance).


Reply to this email directly or view it on GitHub:
https://github.com/doctrine/phpcr-odm/pull/665/files#r41645115

Sent from my Android device with K-9 Mail. Please excuse my brevity.


// Fails - returns "foo"
// $this->assertEquals('Hello everybody!', $articleInstance->text);

// Fails, could not find /functional/article-1
$this->dm->flush();
$this->dm->clear();

$this->assertEquals('Hello everybody!', $article->topic);
}
}