Complex classes like SapphireTest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use SapphireTest, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 47 | class SapphireTest extends PHPUnit_Framework_TestCase |
||
| 48 | { |
||
| 49 | |||
| 50 | /** @config */ |
||
| 51 | private static $dependencies = array( |
||
| 52 | 'fixtureFactory' => '%$FixtureFactory', |
||
| 53 | ); |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Path to fixture data for this test run. |
||
| 57 | * If passed as an array, multiple fixture files will be loaded. |
||
| 58 | * Please note that you won't be able to refer with "=>" notation |
||
| 59 | * between the fixtures, they act independent of each other. |
||
| 60 | * |
||
| 61 | * @var string|array |
||
| 62 | */ |
||
| 63 | protected static $fixture_file = null; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @var FixtureFactory |
||
| 67 | */ |
||
| 68 | protected $fixtureFactory; |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @var Boolean If set to TRUE, this will force a test database to be generated |
||
| 72 | * in {@link setUp()}. Note that this flag is overruled by the presence of a |
||
| 73 | * {@link $fixture_file}, which always forces a database build. |
||
| 74 | */ |
||
| 75 | protected $usesDatabase = null; |
||
| 76 | protected $originalMemberPasswordValidator; |
||
| 77 | protected $originalRequirements; |
||
| 78 | protected $originalIsRunningTest; |
||
| 79 | protected $originalNestedURLsState; |
||
| 80 | protected $originalMemoryLimit; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @var TestMailer |
||
| 84 | */ |
||
| 85 | protected $mailer; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Pointer to the manifest that isn't a test manifest |
||
| 89 | */ |
||
| 90 | protected static $regular_manifest; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @var boolean |
||
| 94 | */ |
||
| 95 | protected static $is_running_test = false; |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @var ClassManifest |
||
| 99 | */ |
||
| 100 | protected static $test_class_manifest; |
||
| 101 | |||
| 102 | /** |
||
| 103 | * By default, setUp() does not require default records. Pass |
||
| 104 | * class names in here, and the require/augment default records |
||
| 105 | * function will be called on them. |
||
| 106 | */ |
||
| 107 | protected $requireDefaultRecordsFrom = array(); |
||
| 108 | |||
| 109 | |||
| 110 | /** |
||
| 111 | * A list of extensions that can't be applied during the execution of this run. If they are |
||
| 112 | * applied, they will be temporarily removed and a database migration called. |
||
| 113 | * |
||
| 114 | * The keys of the are the classes that the extensions can't be applied the extensions to, and |
||
| 115 | * the values are an array of illegal extensions on that class. |
||
| 116 | */ |
||
| 117 | protected $illegalExtensions = array( |
||
| 118 | ); |
||
| 119 | |||
| 120 | /** |
||
| 121 | * A list of extensions that must be applied during the execution of this run. If they are |
||
| 122 | * not applied, they will be temporarily added and a database migration called. |
||
| 123 | * |
||
| 124 | * The keys of the are the classes to apply the extensions to, and the values are an array |
||
| 125 | * of required extensions on that class. |
||
| 126 | * |
||
| 127 | * Example: |
||
| 128 | * <code> |
||
| 129 | * array("MyTreeDataObject" => array("Versioned", "Hierarchy")) |
||
| 130 | * </code> |
||
| 131 | */ |
||
| 132 | protected $requiredExtensions = array( |
||
| 133 | ); |
||
| 134 | |||
| 135 | /** |
||
| 136 | * By default, the test database won't contain any DataObjects that have the interface TestOnly. |
||
| 137 | * This variable lets you define additional TestOnly DataObjects to set up for this test. |
||
| 138 | * Set it to an array of DataObject subclass names. |
||
| 139 | */ |
||
| 140 | protected $extraDataObjects = array(); |
||
| 141 | |||
| 142 | /** |
||
| 143 | * List of class names of {@see Controller} objects to register routes for |
||
| 144 | * Controllers must implement Link() method |
||
| 145 | * |
||
| 146 | * @var array |
||
| 147 | */ |
||
| 148 | protected $extraControllers = []; |
||
| 149 | |||
| 150 | /** |
||
| 151 | * We need to disabling backing up of globals to avoid overriding |
||
| 152 | * the few globals SilverStripe relies on, like $lang for the i18n subsystem. |
||
| 153 | * |
||
| 154 | * @see http://sebastian-bergmann.de/archives/797-Global-Variables-and-PHPUnit.html |
||
| 155 | */ |
||
| 156 | protected $backupGlobals = false; |
||
| 157 | |||
| 158 | /** |
||
| 159 | * Helper arrays for illegalExtensions/requiredExtensions code |
||
| 160 | */ |
||
| 161 | private $extensionsToReapply = array(), $extensionsToRemove = array(); |
||
|
|
|||
| 162 | |||
| 163 | /** |
||
| 164 | * Check flushables on setupOnce() |
||
| 165 | * |
||
| 166 | * @var bool |
||
| 167 | */ |
||
| 168 | protected static $flushedFlushables = false; |
||
| 169 | |||
| 170 | /** |
||
| 171 | * Determines if unit tests are currently run, flag set during test bootstrap. |
||
| 172 | * This is used as a cheap replacement for fully mockable state |
||
| 173 | * in certain contiditions (e.g. access checks). |
||
| 174 | * Caution: When set to FALSE, certain controllers might bypass |
||
| 175 | * access checks, so this is a very security sensitive setting. |
||
| 176 | * |
||
| 177 | * @return boolean |
||
| 178 | */ |
||
| 179 | public static function is_running_test() |
||
| 183 | |||
| 184 | public static function set_is_running_test($bool) |
||
| 188 | |||
| 189 | /** |
||
| 190 | * Set the manifest to be used to look up test classes by helper functions |
||
| 191 | * |
||
| 192 | * @param ClassManifest $manifest |
||
| 193 | */ |
||
| 194 | public static function set_test_class_manifest($manifest) |
||
| 198 | |||
| 199 | /** |
||
| 200 | * Return the manifest being used to look up test classes by helper functions |
||
| 201 | * |
||
| 202 | * @return ClassManifest |
||
| 203 | */ |
||
| 204 | public static function get_test_class_manifest() |
||
| 208 | |||
| 209 | /** |
||
| 210 | * @return String |
||
| 211 | */ |
||
| 212 | public static function get_fixture_file() |
||
| 216 | |||
| 217 | protected $model; |
||
| 218 | |||
| 219 | /** |
||
| 220 | * State of Versioned before this test is run |
||
| 221 | * |
||
| 222 | * @var string |
||
| 223 | */ |
||
| 224 | protected $originalReadingMode = null; |
||
| 225 | |||
| 226 | public function setUp() |
||
| 326 | |||
| 327 | /** |
||
| 328 | * Called once per test case ({@link SapphireTest} subclass). |
||
| 329 | * This is different to {@link setUp()}, which gets called once |
||
| 330 | * per method. Useful to initialize expensive operations which |
||
| 331 | * don't change state for any called method inside the test, |
||
| 332 | * e.g. dynamically adding an extension. See {@link tearDownOnce()} |
||
| 333 | * for tearing down the state again. |
||
| 334 | */ |
||
| 335 | public function setUpOnce() |
||
| 336 | { |
||
| 337 | //nest config and injector for each suite so they are effectively sandboxed |
||
| 338 | Config::nest(); |
||
| 339 | Injector::nest(); |
||
| 340 | $isAltered = false; |
||
| 341 | |||
| 342 | if (!Director::isDev()) { |
||
| 343 | user_error('Tests can only run in "dev" mode', E_USER_ERROR); |
||
| 344 | } |
||
| 345 | |||
| 346 | // Remove any illegal extensions that are present |
||
| 347 | foreach ($this->illegalExtensions as $class => $extensions) { |
||
| 348 | foreach ($extensions as $extension) { |
||
| 349 | if ($class::has_extension($extension)) { |
||
| 350 | if (!isset($this->extensionsToReapply[$class])) { |
||
| 351 | $this->extensionsToReapply[$class] = array(); |
||
| 352 | } |
||
| 353 | $this->extensionsToReapply[$class][] = $extension; |
||
| 354 | $class::remove_extension($extension); |
||
| 355 | $isAltered = true; |
||
| 356 | } |
||
| 357 | } |
||
| 358 | } |
||
| 359 | |||
| 360 | // Add any required extensions that aren't present |
||
| 361 | foreach ($this->requiredExtensions as $class => $extensions) { |
||
| 362 | $this->extensionsToRemove[$class] = array(); |
||
| 363 | foreach ($extensions as $extension) { |
||
| 364 | if (!$class::has_extension($extension)) { |
||
| 365 | if (!isset($this->extensionsToRemove[$class])) { |
||
| 366 | $this->extensionsToReapply[$class] = array(); |
||
| 367 | } |
||
| 368 | $this->extensionsToRemove[$class][] = $extension; |
||
| 369 | $class::add_extension($extension); |
||
| 370 | $isAltered = true; |
||
| 371 | } |
||
| 372 | } |
||
| 373 | } |
||
| 374 | |||
| 375 | // If we have made changes to the extensions present, then migrate the database schema. |
||
| 376 | if ($isAltered || $this->extensionsToReapply || $this->extensionsToRemove || $this->getExtraDataObjects()) { |
||
| 377 | DataObject::reset(); |
||
| 378 | if (!self::using_temp_db()) { |
||
| 379 | self::create_temp_db(); |
||
| 380 | } |
||
| 381 | $this->resetDBSchema(true); |
||
| 382 | } |
||
| 383 | // clear singletons, they're caching old extension info |
||
| 384 | // which is used in DatabaseAdmin->doBuild() |
||
| 385 | Injector::inst()->unregisterAllObjects(); |
||
| 386 | |||
| 387 | // Set default timezone consistently to avoid NZ-specific dependencies |
||
| 388 | date_default_timezone_set('UTC'); |
||
| 389 | |||
| 390 | // Flush all flushable records |
||
| 391 | $flush = !empty($_GET['flush']); |
||
| 392 | if (!self::$flushedFlushables && $flush) { |
||
| 393 | self::$flushedFlushables = true; |
||
| 394 | foreach (ClassInfo::implementorsOf(Flushable::class) as $class) { |
||
| 395 | $class::flush(); |
||
| 396 | } |
||
| 397 | } |
||
| 398 | } |
||
| 399 | |||
| 400 | /** |
||
| 401 | * tearDown method that's called once per test class rather once per test method. |
||
| 402 | */ |
||
| 403 | public function tearDownOnce() |
||
| 436 | |||
| 437 | /** |
||
| 438 | * @return FixtureFactory |
||
| 439 | */ |
||
| 440 | public function getFixtureFactory() |
||
| 447 | |||
| 448 | public function setFixtureFactory(FixtureFactory $factory) |
||
| 453 | |||
| 454 | /** |
||
| 455 | * Get the ID of an object from the fixture. |
||
| 456 | * |
||
| 457 | * @param string $className The data class, as specified in your fixture file. Parent classes won't work |
||
| 458 | * @param string $identifier The identifier string, as provided in your fixture file |
||
| 459 | * @return int |
||
| 460 | */ |
||
| 461 | protected function idFromFixture($className, $identifier) |
||
| 475 | |||
| 476 | /** |
||
| 477 | * Return all of the IDs in the fixture of a particular class name. |
||
| 478 | * Will collate all IDs form all fixtures if multiple fixtures are provided. |
||
| 479 | * |
||
| 480 | * @param string $className |
||
| 481 | * @return array A map of fixture-identifier => object-id |
||
| 482 | */ |
||
| 483 | protected function allFixtureIDs($className) |
||
| 487 | |||
| 488 | /** |
||
| 489 | * Get an object from the fixture. |
||
| 490 | * |
||
| 491 | * @param string $className The data class, as specified in your fixture file. Parent classes won't work |
||
| 492 | * @param string $identifier The identifier string, as provided in your fixture file |
||
| 493 | * |
||
| 494 | * @return DataObject |
||
| 495 | */ |
||
| 496 | protected function objFromFixture($className, $identifier) |
||
| 510 | |||
| 511 | /** |
||
| 512 | * Load a YAML fixture file into the database. |
||
| 513 | * Once loaded, you can use idFromFixture() and objFromFixture() to get items from the fixture. |
||
| 514 | * Doesn't clear existing fixtures. |
||
| 515 | * |
||
| 516 | * @param string $fixtureFile The location of the .yml fixture file, relative to the site base dir |
||
| 517 | */ |
||
| 518 | public function loadFixture($fixtureFile) |
||
| 523 | |||
| 524 | /** |
||
| 525 | * Clear all fixtures which were previously loaded through |
||
| 526 | * {@link loadFixture()} |
||
| 527 | */ |
||
| 528 | public function clearFixtures() |
||
| 532 | |||
| 533 | /** |
||
| 534 | * Useful for writing unit tests without hardcoding folder structures. |
||
| 535 | * |
||
| 536 | * @return String Absolute path to current class. |
||
| 537 | */ |
||
| 538 | protected function getCurrentAbsolutePath() |
||
| 546 | |||
| 547 | /** |
||
| 548 | * @return String File path relative to webroot |
||
| 549 | */ |
||
| 550 | protected function getCurrentRelativePath() |
||
| 559 | |||
| 560 | public function tearDown() |
||
| 600 | |||
| 601 | public static function assertContains( |
||
| 614 | |||
| 615 | public static function assertNotContains( |
||
| 628 | |||
| 629 | /** |
||
| 630 | * Clear the log of emails sent |
||
| 631 | */ |
||
| 632 | public function clearEmails() |
||
| 636 | |||
| 637 | /** |
||
| 638 | * Search for an email that was sent. |
||
| 639 | * All of the parameters can either be a string, or, if they start with "/", a PREG-compatible regular expression. |
||
| 640 | * @param $to |
||
| 641 | * @param $from |
||
| 642 | * @param $subject |
||
| 643 | * @param $content |
||
| 644 | * @return array Contains keys: 'type', 'to', 'from', 'subject','content', 'plainContent', 'attachedFiles', |
||
| 645 | * 'customHeaders', 'htmlContent', 'inlineImages' |
||
| 646 | */ |
||
| 647 | public function findEmail($to, $from = null, $subject = null, $content = null) |
||
| 651 | |||
| 652 | /** |
||
| 653 | * Assert that the matching email was sent since the last call to clearEmails() |
||
| 654 | * All of the parameters can either be a string, or, if they start with "/", a PREG-compatible regular expression. |
||
| 655 | * @param $to |
||
| 656 | * @param $from |
||
| 657 | * @param $subject |
||
| 658 | * @param $content |
||
| 659 | * @return array Contains the keys: 'type', 'to', 'from', 'subject', 'content', 'plainContent', 'attachedFiles', |
||
| 660 | * 'customHeaders', 'htmlContent', inlineImages' |
||
| 661 | */ |
||
| 662 | public function assertEmailSent($to, $from = null, $subject = null, $content = null) |
||
| 689 | |||
| 690 | |||
| 691 | /** |
||
| 692 | * Assert that the given {@link SS_List} includes DataObjects matching the given key-value |
||
| 693 | * pairs. Each match must correspond to 1 distinct record. |
||
| 694 | * |
||
| 695 | * @param SS_List|array $matches The patterns to match. Each pattern is a map of key-value pairs. You can |
||
| 696 | * either pass a single pattern or an array of patterns. |
||
| 697 | * @param SS_List $dataObjectSet The {@link SS_List} to test. |
||
| 698 | * |
||
| 699 | * Examples |
||
| 700 | * -------- |
||
| 701 | * Check that $members includes an entry with Email = [email protected]: |
||
| 702 | * $this->assertDOSContains(array('Email' => '[email protected]'), $members); |
||
| 703 | * |
||
| 704 | * Check that $members includes entries with Email = [email protected] and with |
||
| 705 | * Email = [email protected]: |
||
| 706 | * $this->assertDOSContains(array( |
||
| 707 | * array('Email' => '[email protected]'), |
||
| 708 | * array('Email' => '[email protected]'), |
||
| 709 | * ), $members); |
||
| 710 | */ |
||
| 711 | public function assertDOSContains($matches, $dataObjectSet) |
||
| 739 | /** |
||
| 740 | * Asserts that no items in a given list appear in the given dataobject list |
||
| 741 | * |
||
| 742 | * @param SS_List|array $matches The patterns to match. Each pattern is a map of key-value pairs. You can |
||
| 743 | * either pass a single pattern or an array of patterns. |
||
| 744 | * @param SS_List $dataObjectSet The {@link SS_List} to test. |
||
| 745 | * |
||
| 746 | * Examples |
||
| 747 | * -------- |
||
| 748 | * Check that $members doesn't have an entry with Email = [email protected]: |
||
| 749 | * $this->assertNotDOSContains(array('Email' => '[email protected]'), $members); |
||
| 750 | * |
||
| 751 | * Check that $members doesn't have entries with Email = [email protected] and with |
||
| 752 | * Email = [email protected]: |
||
| 753 | * $this->assertNotDOSContains(array( |
||
| 754 | * array('Email' => '[email protected]'), |
||
| 755 | * array('Email' => '[email protected]'), |
||
| 756 | * ), $members); |
||
| 757 | */ |
||
| 758 | public function assertNotDOSContains($matches, $dataObjectSet) |
||
| 783 | |||
| 784 | /** |
||
| 785 | * Assert that the given {@link SS_List} includes only DataObjects matching the given |
||
| 786 | * key-value pairs. Each match must correspond to 1 distinct record. |
||
| 787 | * |
||
| 788 | * Example |
||
| 789 | * -------- |
||
| 790 | * Check that *only* the entries Sam Minnee and Ingo Schommer exist in $members. Order doesn't |
||
| 791 | * matter: |
||
| 792 | * $this->assertDOSEquals(array( |
||
| 793 | * array('FirstName' =>'Sam', 'Surname' => 'Minnee'), |
||
| 794 | * array('FirstName' => 'Ingo', 'Surname' => 'Schommer'), |
||
| 795 | * ), $members); |
||
| 796 | * |
||
| 797 | * @param mixed $matches The patterns to match. Each pattern is a map of key-value pairs. You can |
||
| 798 | * either pass a single pattern or an array of patterns. |
||
| 799 | * @param mixed $dataObjectSet The {@link SS_List} to test. |
||
| 800 | */ |
||
| 801 | public function assertDOSEquals($matches, $dataObjectSet) |
||
| 843 | |||
| 844 | /** |
||
| 845 | * Assert that the every record in the given {@link SS_List} matches the given key-value |
||
| 846 | * pairs. |
||
| 847 | * |
||
| 848 | * Example |
||
| 849 | * -------- |
||
| 850 | * Check that every entry in $members has a Status of 'Active': |
||
| 851 | * $this->assertDOSAllMatch(array('Status' => 'Active'), $members); |
||
| 852 | * |
||
| 853 | * @param mixed $match The pattern to match. The pattern is a map of key-value pairs. |
||
| 854 | * @param mixed $dataObjectSet The {@link SS_List} to test. |
||
| 855 | */ |
||
| 856 | public function assertDOSAllMatch($match, $dataObjectSet) |
||
| 872 | |||
| 873 | /** |
||
| 874 | * Removes sequences of repeated whitespace characters from SQL queries |
||
| 875 | * making them suitable for string comparison |
||
| 876 | * |
||
| 877 | * @param string $sql |
||
| 878 | * @return string The cleaned and normalised SQL string |
||
| 879 | */ |
||
| 880 | protected function normaliseSQL($sql) |
||
| 884 | |||
| 885 | /** |
||
| 886 | * Asserts that two SQL queries are equivalent |
||
| 887 | * |
||
| 888 | * @param string $expectedSQL |
||
| 889 | * @param string $actualSQL |
||
| 890 | * @param string $message |
||
| 891 | * @param float|int $delta |
||
| 892 | * @param integer $maxDepth |
||
| 893 | * @param boolean $canonicalize |
||
| 894 | * @param boolean $ignoreCase |
||
| 895 | */ |
||
| 896 | public function assertSQLEquals( |
||
| 911 | |||
| 912 | /** |
||
| 913 | * Asserts that a SQL query contains a SQL fragment |
||
| 914 | * |
||
| 915 | * @param string $needleSQL |
||
| 916 | * @param string $haystackSQL |
||
| 917 | * @param string $message |
||
| 918 | * @param boolean $ignoreCase |
||
| 919 | * @param boolean $checkForObjectIdentity |
||
| 920 | */ |
||
| 921 | public function assertSQLContains( |
||
| 933 | |||
| 934 | /** |
||
| 935 | * Asserts that a SQL query contains a SQL fragment |
||
| 936 | * |
||
| 937 | * @param string $needleSQL |
||
| 938 | * @param string $haystackSQL |
||
| 939 | * @param string $message |
||
| 940 | * @param boolean $ignoreCase |
||
| 941 | * @param boolean $checkForObjectIdentity |
||
| 942 | */ |
||
| 943 | public function assertSQLNotContains( |
||
| 955 | |||
| 956 | /** |
||
| 957 | * Helper function for the DOS matchers |
||
| 958 | * |
||
| 959 | * @param array $item |
||
| 960 | * @param array $match |
||
| 961 | * @return bool |
||
| 962 | */ |
||
| 963 | private function dataObjectArrayMatch($item, $match) |
||
| 972 | |||
| 973 | /** |
||
| 974 | * Helper function for the DOS matchers |
||
| 975 | * |
||
| 976 | * @param SS_List|array $dataObjectSet |
||
| 977 | * @param array $match |
||
| 978 | * @return string |
||
| 979 | */ |
||
| 980 | private function DOSSummaryForMatch($dataObjectSet, $match) |
||
| 988 | |||
| 989 | /** |
||
| 990 | * Pushes a class and template manifest instance that include tests onto the |
||
| 991 | * top of the loader stacks. |
||
| 992 | */ |
||
| 993 | public static function use_test_manifest() |
||
| 1022 | |||
| 1023 | /** |
||
| 1024 | * Returns true if we are currently using a temporary database |
||
| 1025 | */ |
||
| 1026 | public static function using_temp_db() |
||
| 1033 | |||
| 1034 | public static function kill_temp_db() |
||
| 1055 | |||
| 1056 | /** |
||
| 1057 | * Remove all content from the temporary database. |
||
| 1058 | */ |
||
| 1059 | public static function empty_temp_db() |
||
| 1075 | |||
| 1076 | public static function create_temp_db() |
||
| 1103 | |||
| 1104 | public static function delete_all_temp_dbs() |
||
| 1119 | |||
| 1120 | /** |
||
| 1121 | * Reset the testing database's schema. |
||
| 1122 | * @param bool $includeExtraDataObjects If true, the extraDataObjects tables will also be included |
||
| 1123 | */ |
||
| 1124 | public function resetDBSchema($includeExtraDataObjects = false) |
||
| 1164 | |||
| 1165 | /** |
||
| 1166 | * Create a member and group with the given permission code, and log in with it. |
||
| 1167 | * Returns the member ID. |
||
| 1168 | * |
||
| 1169 | * @param string|array $permCode Either a permission, or list of permissions |
||
| 1170 | * @return int Member ID |
||
| 1171 | */ |
||
| 1172 | public function logInWithPermission($permCode = "ADMIN") |
||
| 1216 | |||
| 1217 | /** |
||
| 1218 | * Cache for logInWithPermission() |
||
| 1219 | */ |
||
| 1220 | protected $cache_generatedMembers = array(); |
||
| 1221 | |||
| 1222 | |||
| 1223 | /** |
||
| 1224 | * Test against a theme. |
||
| 1225 | * |
||
| 1226 | * @param string $themeBaseDir themes directory |
||
| 1227 | * @param string $theme Theme name |
||
| 1228 | * @param callable $callback |
||
| 1229 | * @throws Exception |
||
| 1230 | */ |
||
| 1231 | protected function useTestTheme($themeBaseDir, $theme, $callback) |
||
| 1255 | |||
| 1256 | /** |
||
| 1257 | * Get fixture paths for this test |
||
| 1258 | * |
||
| 1259 | * @return array List of paths |
||
| 1260 | */ |
||
| 1261 | protected function getFixturePaths() |
||
| 1274 | |||
| 1275 | /** |
||
| 1276 | * Return all extra objects to scaffold for this test |
||
| 1277 | * |
||
| 1278 | * @return array |
||
| 1279 | */ |
||
| 1280 | protected function getExtraDataObjects() |
||
| 1284 | |||
| 1285 | /** |
||
| 1286 | * Get additional controller classes to register routes for |
||
| 1287 | * |
||
| 1288 | * @return array |
||
| 1289 | */ |
||
| 1290 | protected function getExtraControllers() |
||
| 1294 | |||
| 1295 | /** |
||
| 1296 | * Map a fixture path to a physical file |
||
| 1297 | * |
||
| 1298 | * @param string $fixtureFilePath |
||
| 1299 | * @return string |
||
| 1300 | */ |
||
| 1301 | protected function resolveFixturePath($fixtureFilePath) |
||
| 1324 | |||
| 1325 | protected function setUpRoutes() |
||
| 1341 | } |
||
| 1342 |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.