Skip to content

Instantly share code, notes, and snippets.

@everzet
Created May 19, 2011 21:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save everzet/981759 to your computer and use it in GitHub Desktop.
Save everzet/981759 to your computer and use it in GitHub Desktop.
Why RSpec is not possible in PHP
<?php
/*
Why i think, that "RSpec is not possible in PHP"?
Cuz Ruby's syntax abilities can represent
natural language constructions:
object should equals 2
almost without changes in specs:
object.should == 2 || object.should equals(2)
but PHP: */
$this->spec($object)->should()->be(2);
/* does NOT!
And what's even worse - this construction
is far less readable, than more natural in
php assertions: */
$this->assertEquals(2, $object);
/* Why?
1. Cuz `->` is a READABLE noize in counterpart with non-readable `.`.
2. Cuz `$this->method(...)` is not a `method ...`
3. Cuz `$this->object` is not a `@object`
4. Cuz `$this->spec(...)` doesn't make sense at all in terms of behavior description.
It's again - readable noize
*/
@dbernar1
Copy link

dbernar1 commented Jan 6, 2012

Though I do think that it would be easier to just teach Ruby to run PHP and to inspect PHP memory state.

@angelxmoreno
Copy link

lol, this is bananas. @dbernar1 "PHP's syntax" ? that syntax is not unique to PHP buddy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment