Skip to content

Commit

Permalink
Rename 'upgrade snapshots' to 'upgrade examples'
Browse files Browse the repository at this point in the history
The phrase 'upgrade snapshots' is also used within core for a different thing.
  • Loading branch information
totten committed Jul 21, 2022
1 parent 1963afd commit 7122c40
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ composer install

```bash
## Find snapshots from 5.0.0 through 5.30.0
./bin/civicrm-upgrade-snapshots @5.0.0..5.30.0
./bin/civicrm-upgrade-examples @5.0.0..5.30.0
```

### Running Test Cases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function main($args) {
}

$files = array();
$upgradeSnapshots = UpgradeSnapshots::instance();
$examples = UpgradeExamples::instance();
while (!empty($args)) {
$arg = array_shift($args);

Expand All @@ -44,15 +44,15 @@ function main($args) {
$files[] = $arg;
}
elseif ($arg[0] === '@' || strpos($arg, '*')) {
$files = array_merge($files, $upgradeSnapshots->find($arg));
$files = array_merge($files, $examples->find($arg));
}
else {
help("Unrecognized argument or missing file: $arg\n");
exit(3);
}
}

$files = $upgradeSnapshots->sortFilesByVer(array_unique($files));
$files = $examples->sortFilesByVer(array_unique($files));
foreach ($files as $file) {
echo "$file\n";
}
Expand Down
2 changes: 1 addition & 1 deletion bin/civicrm-upgrade-test
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ while [ -n "$1" ]; do
done

echo "Identify files: [$DATABASE_EXPRS]"
DATABASE_FILES=$(eval php "$SCRIPT_DIR/civicrm-upgrade-snapshots" $DATABASE_EXPRS)
DATABASE_FILES=$(eval php "$SCRIPT_DIR/civicrm-upgrade-examples" $DATABASE_EXPRS)
if [ $? -ne 0 ]; then
echo "Failed to evaluate expression \"$1\" => $DATABASE_FILES" >> /dev/stderr
exit 1
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"homepage": "https://github.com/civicrm/civicrm-upgrade-test",
"license": "AGPL-3.0",
"bin": [
"bin/civicrm-upgrade-snapshots",
"bin/civicrm-upgrade-examples",
"bin/civicrm-upgrade-test"
],
"autoload": {
Expand Down
8 changes: 4 additions & 4 deletions src/UpgradeSnapshots.php → src/UpgradeExamples.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php
namespace Civi\UpgradeTest;

class UpgradeSnapshots {
class UpgradeExamples {

/**
* Get a default instance (based on the colocated list of snapshot files).
*
* @return \Civi\UpgradeTest\UpgradeSnapshots
* @return \Civi\UpgradeTest\UpgradeExamples
*/
public static function instance(): UpgradeSnapshots {
public static function instance(): UpgradeExamples {
static $instance;
$instance = $instance ?: new UpgradeSnapshots(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'databases');
$instance = $instance ?: new UpgradeExamples(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'databases');
return $instance;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/FindFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function getExamples(): array {
* @dataProvider getExamples
*/
public function testExamples($pattern, array $expectFileNames): void {
$actualFilePaths = UpgradeSnapshots::instance()->find($pattern);
$actualFilePaths = UpgradeExamples::instance()->find($pattern);
foreach ($actualFilePaths as $actualFile) {
$this->assertTrue(file_exists($actualFile), "Identified file [$actualFile] should exist");
}
Expand All @@ -29,8 +29,8 @@ public function testExamples($pattern, array $expectFileNames): void {
}

public function testMaxCount() {
$big = UpgradeSnapshots::instance()->find('@4.0..4.5');
$little = UpgradeSnapshots::instance()->find('@4.0..4.5:3');
$big = UpgradeExamples::instance()->find('@4.0..4.5');
$little = UpgradeExamples::instance()->find('@4.0..4.5:3');
$this->assertEquals(3, count($little));
$this->assertTrue(count($big) > count($little));
$this->assertEquals($little, array_intersect($little, $big), 'All items in $little are also in $big');
Expand Down
2 changes: 1 addition & 1 deletion tests/ParseFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testMisc() {
}

protected function assertFilterExpr($expected, $filterExpr) {
$parsed = UpgradeSnapshots::instance()->parseFilterExpr($filterExpr);
$parsed = UpgradeExamples::instance()->parseFilterExpr($filterExpr);
$this->assertEquals($expected, $parsed, "Parsing \"$filterExpr\": ");
}

Expand Down

0 comments on commit 7122c40

Please sign in to comment.