| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | protected function setUp() |
||
| 22 | { |
||
| 23 | parent::setUp(); |
||
| 24 | |||
| 25 | /* |
||
| 26 | * We set the locale for pages explicitly, because if we don't, then we get into a situation |
||
| 27 | * where the page takes on the tester's (your) locale, and any calls to simulate subsequent requests |
||
| 28 | * (e.g. $this->post()) do not seem to get passed the tester's locale, but instead fallback to the default locale. |
||
| 29 | * |
||
| 30 | * So we set the pages locale to be the default locale, which will then match any subsequent requests. |
||
| 31 | * |
||
| 32 | * If creating pages in your unit tests (rather than reading from the fixtures file), you must explicitly call |
||
| 33 | * self::compat() on the page, for the same reasons as above. |
||
| 34 | */ |
||
| 35 | if (class_exists(Translatable::class)) { |
||
| 36 | $this->translatableEnabledBefore = SiteTree::has_extension(Translatable::class); |
||
| 37 | SiteTree::remove_extension(Translatable::class); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 52 |