Giter VIP home page Giter VIP logo

drift's People

Contributors

alexmartinfr avatar caneco avatar dannyvdsluijs avatar nunomaduro avatar octoper avatar olivernybroe avatar owenvoke avatar tomasvotruba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

drift's Issues

Command line tool

So as drift is going to have a command line tool, I think we should discuss how the command should work and what should be available.

My first idea is the following

# Change the code to pest test classes
$ drift migrate {path}

# Show the diff instead of actually changing the code.
$ drift show {$path}

Would love to hear if you guys have some better ideas for naming ๐Ÿ‘

For example rector uses the following syntax

# Change code based in the specified path based on the specified set
$ vendor/bin/rector process  {path} --set {set-name}

# Show the diffs instead
$ vendor/bin/rector process  {path} --set {set-name} --dry-run

Drift branding

I experimented with some branding idea for Drift and came up with this:
Drift for Pest

Lighting and colors would need more work, but if you like the idea I could explore that further.

Also, very hard to convey an 80's vibe on a white background, so I cheated with this dark one!

Following Drift installation steps doesn't work with Pest 0.3.1

Hi all and many thanks for trying to get such a transformation package available.

While following the basic installations steps from https://pestphp.com/docs/installation/ followed by https://pestphp.com/docs/guides/drift/. I end up with an error Your requirements could not be resolved to an installable set of packages. It seems there is some conflicts going on.

Full error from running composer require pestphp/drift --dev --update-with-all-dependencies:

  Problem 1
    - pestphp/pest v0.2.x-dev conflicts with pestphp/pest-plugin-init[v0.3.0].
    - pestphp/pest v0.2.x-dev conflicts with pestphp/pest-plugin-init[v0.3.0].
    - pestphp/pest v0.2.x-dev conflicts with pestphp/pest-plugin-init[v0.3.0].
    - pestphp/drift dev-master requires pestphp/pest ^0.2 -> satisfiable by pestphp/pest[v0.2.x-dev].
    - Installation request for pestphp/drift dev-master -> satisfiable by pestphp/drift[dev-master].
    - Installation request for pestphp/pest-plugin-init (locked at v0.3.0) -> satisfiable by pestphp/pest-plugin-init[v0.3.0].


Composer.json and Composer.lock created can be found at https://gist.github.com/DannyvdSluijs/92f1b30ba65de5122b5285fa443ec0eb

[Rector] Ordering

Let's create a new rector which orders the test alphabetically

The reason for using a new rector is so we can optionally enable/disable it and decouple it from the base rector which is about just refactoring to pest test cases, not making them nicer.

[Rector] Dataset to shared dataset

Let's create a new rector which refactors the dataset to a shared dataset.

The reason for using a new rector is so we can optionally enable/disable it and decouple it from the base rector which is about just refactoring to pest test cases, not making them nicer.

Pest Docs

Write docs for CLI tool

We have a small CLI tool which has no documentation at all.

We should write a small section in the readme file on how to use it.

[Rector] Remove $this

Create a new rector which is responsible for removing $this on methods that doesn't need them.

it('asserts true is true', function () {
    $this->assertTrue(true);

    // Same as
    assertTrue(true);
});

The reason for using a new rector is so we can optionally enable/disable it and decouple it from the base rector which is about just refactoring to pest test cases, not making them nicer.

Pest docs

Add a Phar with dependencies

I think drift could benefit from a phar with dependencies, as that would remove all conflicts caused by the dependencies.

[Rector] Higher Order Tests

Let's create a new rector which can migrate a pest test into a higher order test.

The reason for using a new rector is so we can optionally enable/disable it and decouple it from the base rector which is about just refactoring to pest test cases, not making them nicer.

Pest Docs

Missing core features

Right now drift is not complete at all, there are still a bunch of features which it cannot migrate.

Here is a list of it, so we know what we need to work on before having "complete" refactor. (if something is missing, just edit the list and add it or post a comment and I'll add it)

  • Data providers
  • Exception throwing
  • Helper methods
  • Skipping tests
  • setUp/tearDown
  • beforeClass/afterClass
  • Migrate traits to uses statements

How to run tests?

Hey friends, Can you tell me how to run tests in drift? They seem to be failing in my machine.

[Rector] Renaming

Create a new rector for renaming the test.

For example when migrating a phpunit test it will take the method name directly and not touch the name. This rectors responsible should be to rename the test to have a more pest like naming.

Add support for String Interpolation when migrating helper methods

Right now we have a test which fails because we are trying to migrate a class method to a pest helper method.

However the original class method was used in string interpolation which is not supported by functions, so the string interpolation has to be split up, so it can use the pest helper.

Example:
We have the following php class

class MethodStringInterpolationTest extends TestCase
{
    private function alwaysTrueHelper()
    {
        return "true";
    }

    public function testMethod()
    {
        "{$this->alwaysTrueHelper()} works";
    }
}

Which should be converted to

function alwaysTrueHelper()
{
    return "true";
}
test('testMethod', function () {
    alwaysTrueHelper() . " works";
});

Because doing "{alwaysTrueHelper()} works"; is not valid php code.

Fixture file:
https://github.com/pestphp/drift/blob/master/tests/fixtures/PHPUnit/ClassMethod/HelperMethodRector/phpunit_method_to_pest_helper_used_in_string_interpolation.php.inc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.