Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Update the Direct Message text limit #40

Merged
merged 3 commits into from
Aug 15, 2017

Conversation

weierophinney
Copy link
Member

PRs #34 and #39 remove the direct message limit when creating a new direct message to a user. However, per https://dev.twitter.com/rest/reference/post/direct_messages/events/new, DM text can be no more than 10k characters in length.

This patch is based on #39, and will be rebased once that PR is merged. It modifies the limit, raising a separate exception if the number of characters is > 10000. Tests have been added for that method to verify the upper and lower bounds of message length.

Adds tests for all new classes (`RateLimit`, `Media`, `Image`, `Video`),
refactoring source code where issues or redundancies were found. Added a
number of new exceptions, as new code was raising SPL exceptions instead
of component exceptions.

Updates the library to only support PHP 7.1+, which also requires an
upgrade to PHPUnit 6.0. This meant converting `setExpectedException()`
calls to `expectException()`/`expectExceptionMessage()`, and using the
namespaced versions of PHPUnit classes. Classes were updated to use
scalar type hints and return type hints.

QA tooling was upgraded as follows:

- Adds 7.1 and 7.2 to testing matrix, allowing failures on 7.2
- Ensures appropriate deps are installed for PHP 5.6
- Use composer scripts for unit tests, CS checks

The file validation routine was updated. Instead of doing a
`file_exists()` call, and then an `fopen()` to determine readability, we
can just do `is_readable()`. That said, the operation needs to be
wrapped in an error handler, as both it and `file_exists()` emit an
`E_WARNING` on failure.

Finally, refactors the `Media` class to use distinct properties
instead of a `$data` array, and remove the
`__get()`/`__isset()`/`__set()` implementations.
Causes issues with PHP 7.2, and unable to find a clean way to ensure
the removal is only run with PHP 7.1. We can disable it later if
necessary.
@weierophinney weierophinney merged commit 321f56b into zendframework:develop Aug 15, 2017
weierophinney added a commit that referenced this pull request Aug 15, 2017
weierophinney added a commit that referenced this pull request Aug 15, 2017
@weierophinney weierophinney deleted the feature/dm-limit branch August 15, 2017 16:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant