| @@ 3219-3286 (lines=68) @@ | ||
| 3216 | * |
|
| 3217 | * @group swap |
|
| 3218 | */ |
|
| 3219 | public function testLocationSwappedSiblingsSimple() |
|
| 3220 | { |
|
| 3221 | $handler = $this->getHandler(); |
|
| 3222 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple.php'); |
|
| 3223 | ||
| 3224 | $countBeforeReusing = $this->countRows(); |
|
| 3225 | ||
| 3226 | $handler->locationSwapped(314, 2, 315, 2); |
|
| 3227 | ||
| 3228 | $this->assertEquals( |
|
| 3229 | $countBeforeReusing, |
|
| 3230 | $this->countRows() |
|
| 3231 | ); |
|
| 3232 | ||
| 3233 | $urlAlias = $handler->lookup('jedan'); |
|
| 3234 | $this->assertEquals( |
|
| 3235 | new UrlAlias( |
|
| 3236 | array( |
|
| 3237 | 'id' => '0-' . md5('jedan'), |
|
| 3238 | 'type' => UrlAlias::LOCATION, |
|
| 3239 | 'destination' => 315, |
|
| 3240 | 'languageCodes' => array( |
|
| 3241 | 'cro-HR', |
|
| 3242 | ), |
|
| 3243 | 'pathData' => array( |
|
| 3244 | array( |
|
| 3245 | 'always-available' => false, |
|
| 3246 | 'translations' => array( |
|
| 3247 | 'cro-HR' => 'jedan', |
|
| 3248 | ), |
|
| 3249 | ), |
|
| 3250 | ), |
|
| 3251 | 'alwaysAvailable' => false, |
|
| 3252 | 'isHistory' => false, |
|
| 3253 | 'isCustom' => false, |
|
| 3254 | 'forward' => false, |
|
| 3255 | ) |
|
| 3256 | ), |
|
| 3257 | $urlAlias |
|
| 3258 | ); |
|
| 3259 | ||
| 3260 | $urlAlias = $handler->lookup('dva'); |
|
| 3261 | $this->assertEquals( |
|
| 3262 | new UrlAlias( |
|
| 3263 | array( |
|
| 3264 | 'id' => '0-' . md5('dva'), |
|
| 3265 | 'type' => UrlAlias::LOCATION, |
|
| 3266 | 'destination' => 314, |
|
| 3267 | 'languageCodes' => array( |
|
| 3268 | 'cro-HR', |
|
| 3269 | ), |
|
| 3270 | 'pathData' => array( |
|
| 3271 | array( |
|
| 3272 | 'always-available' => false, |
|
| 3273 | 'translations' => array( |
|
| 3274 | 'cro-HR' => 'dva', |
|
| 3275 | ), |
|
| 3276 | ), |
|
| 3277 | ), |
|
| 3278 | 'alwaysAvailable' => false, |
|
| 3279 | 'isHistory' => false, |
|
| 3280 | 'isCustom' => false, |
|
| 3281 | 'forward' => false, |
|
| 3282 | ) |
|
| 3283 | ), |
|
| 3284 | $urlAlias |
|
| 3285 | ); |
|
| 3286 | } |
|
| 3287 | ||
| 3288 | /** |
|
| 3289 | * Test for the locationSwapped() method. |
|
| @@ 3293-3360 (lines=68) @@ | ||
| 3290 | * |
|
| 3291 | * @group swap |
|
| 3292 | */ |
|
| 3293 | public function testLocationSwappedSiblingsSimpleReverse() |
|
| 3294 | { |
|
| 3295 | $handler = $this->getHandler(); |
|
| 3296 | $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple.php'); |
|
| 3297 | ||
| 3298 | $countBeforeReusing = $this->countRows(); |
|
| 3299 | ||
| 3300 | $handler->locationSwapped(315, 2, 314, 2); |
|
| 3301 | ||
| 3302 | $this->assertEquals( |
|
| 3303 | $countBeforeReusing, |
|
| 3304 | $this->countRows() |
|
| 3305 | ); |
|
| 3306 | ||
| 3307 | $urlAlias = $handler->lookup('jedan'); |
|
| 3308 | $this->assertEquals( |
|
| 3309 | new UrlAlias( |
|
| 3310 | array( |
|
| 3311 | 'id' => '0-' . md5('jedan'), |
|
| 3312 | 'type' => UrlAlias::LOCATION, |
|
| 3313 | 'destination' => 315, |
|
| 3314 | 'languageCodes' => array( |
|
| 3315 | 'cro-HR', |
|
| 3316 | ), |
|
| 3317 | 'pathData' => array( |
|
| 3318 | array( |
|
| 3319 | 'always-available' => false, |
|
| 3320 | 'translations' => array( |
|
| 3321 | 'cro-HR' => 'jedan', |
|
| 3322 | ), |
|
| 3323 | ), |
|
| 3324 | ), |
|
| 3325 | 'alwaysAvailable' => false, |
|
| 3326 | 'isHistory' => false, |
|
| 3327 | 'isCustom' => false, |
|
| 3328 | 'forward' => false, |
|
| 3329 | ) |
|
| 3330 | ), |
|
| 3331 | $urlAlias |
|
| 3332 | ); |
|
| 3333 | ||
| 3334 | $urlAlias = $handler->lookup('dva'); |
|
| 3335 | $this->assertEquals( |
|
| 3336 | new UrlAlias( |
|
| 3337 | array( |
|
| 3338 | 'id' => '0-' . md5('dva'), |
|
| 3339 | 'type' => UrlAlias::LOCATION, |
|
| 3340 | 'destination' => 314, |
|
| 3341 | 'languageCodes' => array( |
|
| 3342 | 'cro-HR', |
|
| 3343 | ), |
|
| 3344 | 'pathData' => array( |
|
| 3345 | array( |
|
| 3346 | 'always-available' => false, |
|
| 3347 | 'translations' => array( |
|
| 3348 | 'cro-HR' => 'dva', |
|
| 3349 | ), |
|
| 3350 | ), |
|
| 3351 | ), |
|
| 3352 | 'alwaysAvailable' => false, |
|
| 3353 | 'isHistory' => false, |
|
| 3354 | 'isCustom' => false, |
|
| 3355 | 'forward' => false, |
|
| 3356 | ) |
|
| 3357 | ), |
|
| 3358 | $urlAlias |
|
| 3359 | ); |
|
| 3360 | } |
|
| 3361 | ||
| 3362 | /** |
|
| 3363 | * Test for the locationSwapped() method. |
|