Created
September 27, 2016 13:26
-
-
Save sparrow/5f8787d239a891ccb79aba017dbb0f8b to your computer and use it in GitHub Desktop.
This is an PHPUnit code snippet that we used for our blog post https://rubygarage.org/blog/ruby-on-rails-and-symfony-comparison at RubyGarage. It demonstrates how to create a namespace with PHPUnit. This code snippet was taken from the Symfony main website.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// tests/AppBundle/Util/CalculatorTest.php | |
namespace Tests\AppBundle\Util; | |
use AppBundle\Util\Calculator; | |
class CalculatorTest extends \PHPUnit_Framework_TestCase | |
{ | |
public function testAdd() | |
{ | |
$calc = new Calculator(); | |
$result = $calc->add(30, 12); | |
//assert that your calculator added the numbers correctly! | |
$this->assertEquals(42, $result); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment