Skip to content

Commit 064f54c

Browse files
committed
Merge remote-tracking branch 'origin/fix-sort-order-tests' into user-agent
2 parents 260f1b6 + 4aff3b7 commit 064f54c

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

TESTING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ If a test fails, you can inspect the output.
3636

3737
Any errors should be corrected by making applicable code or test changes.
3838

39+
## Run PHP CodeSniffer
40+
41+
[PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) checks that all code meets the [PSR-12 Coding Standards](https://www.php-fig.org/psr/psr-12/).
42+
43+
To run CodeSniffer on tests, enter the following command:
44+
45+
```bash
46+
vendor/bin/phpcs
47+
```
48+
49+
Any errors should be corrected by either:
50+
- making applicable code changes
51+
- (Experimental) running `vendor/bin/phpcbf` to automatically fix coding standards
52+
53+
Need to change the coding standard rules applied? Either:
54+
- ignore a rule in the affected code, by adding `phpcs:ignore {rule}`, where {rule} is the given rule that failed in the above output.
55+
- edit the [phpcs.tests.xml](phpcs.xml) file.
56+
57+
**Rules can be ignored with caution**, but it's essential that rules relating to coding style and inline code commenting / docblocks remain.
58+
3959
## Run PHP CodeSniffer for Tests
4060

4161
[PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) checks that all test code meets the [PSR-12 Coding Standards](https://www.php-fig.org/psr/psr-12/).

tests/ConvertKitAPITest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ public function testGetSequenceSubscriptions()
109109
$this->assertIsArray($result['subscriptions']);
110110

111111
// Assert sort order is ascending.
112-
$this->assertGreaterThan($result['subscriptions'][0]->created_at, $result['subscriptions'][1]->created_at);
112+
$this->assertGreaterThanOrEqual(
113+
$result['subscriptions'][0]->created_at,
114+
$result['subscriptions'][1]->created_at
115+
);
113116
}
114117

115118
/**
@@ -134,7 +137,10 @@ public function testGetSequenceSubscriptionsWithDescSortOrder()
134137
$this->assertIsArray($result['subscriptions']);
135138

136139
// Assert sort order.
137-
$this->assertLessThan($result['subscriptions'][0]->created_at, $result['subscriptions'][1]->created_at);
140+
$this->assertLessThanOrEqual(
141+
$result['subscriptions'][0]->created_at,
142+
$result['subscriptions'][1]->created_at
143+
);
138144
}
139145

140146
/**

0 commit comments

Comments
 (0)