Last active
September 30, 2018 17:20
-
-
Save ivanaugustobd/977ddc80d656be88e12c22c58b81875b to your computer and use it in GitHub Desktop.
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 | |
use App\Htpp\Controllers\CustomersController; | |
class CustomersControllerTest extends TestCase | |
{ | |
public function testCustomerRegister() | |
{ | |
// Simulando os dados necessários | |
$formData = [ | |
'name' => 'Lorem ipsum', | |
'e-mail' => 'lorem@ipsum.com', | |
'phone' => '(31) 3212–1234', | |
// demais campos | |
]; | |
$request = request($formData); | |
// Execuntando a ação | |
(new CustomersController)->store($request); // estamos testando esse método | |
$customer = Customer::where('e-mail', 'lorem@-ipsum.com')->first(); | |
// Testando se o resultado está denro do esperado | |
$this->assertNotNull($customer); | |
$this->assertEquals($formData, $customer->toArray()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment