-
Notifications
You must be signed in to change notification settings - Fork 1
/
ManyToManyTableTest.php
48 lines (32 loc) · 1.45 KB
/
ManyToManyTableTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/*
* This file is part of the sfCacheTaggingPlugin package.
* (c) 2009-2012 Ilya Sabelnikov <fruit.dev@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
include_once realpath(dirname(__FILE__) . '/../../bootstrap/functional.php');
include_once sfConfig::get('sf_symfony_lib_dir') . '/vendor/lime/lime.php';
$t = new lime_test();
sfCacheTaggingToolkit::getTaggingCache()->clean();
$connection = WeaponTable::getInstance()->getConnection();
$connection->beginTransaction();
$tanto = new Weapon();
$tanto->setMaterialId(10);
$tanto->setSizeId(2);
$tanto->setName('Tanto, 10in, red oaky');
$tanto->save();
$firstVersion = $tanto->obtainObjectVersion();
$firstCollectionVersion = $tanto->obtainCollectionVersion();
$tanto = new Weapon();
$tanto->setMaterialId(10);
$tanto->setSizeId(2);
$tanto->setName('Tanto, 9in, red oaky');
$tanto->replace();
$secordVersion = $tanto->obtainObjectVersion();
$t->cmp_ok($firstVersion, '<', $secordVersion, '->replace() increments tag version');
$tanto = WeaponTable::getInstance()->findOneByName('Tanto, 9in, red oaky');
$t->is($tanto->obtainObjectVersion(), $secordVersion, 'Saved object version match with generated before');
$t->is($tanto->obtainCollectionVersion(), $firstCollectionVersion, 'Saved collection version match with generated before');
$connection->rollback();