Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Symfony][SF2][SF]problem z testami w symfony
symer
post 26.07.2018, 10:12:08
Post #1





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 24.08.2017

Ostrzeżenie: (0%)
-----


Witam . Instaluje od nowa paczkę symfony 3.3 . Wpisuje w cmd phpunit tests\AppBundle\Controller\DefaultContr
ollerTest.php i pokazuje mi komunikat : No test executed . Co robię źle?
Go to the top of the page
+Quote Post
kallosz
post 26.07.2018, 15:36:34
Post #2





Grupa: Zarejestrowani
Postów: 272
Pomógł: 19
Dołączył: 29.07.2006

Ostrzeżenie: (10%)
X----


musisz najpierw napisać test.


--------------------
Pomogłem ?? Kliknij pomógł :) || kallosz.pl
-----------------------------------
Go to the top of the page
+Quote Post
symer
post 27.07.2018, 09:35:28
Post #3





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 24.08.2017

Ostrzeżenie: (0%)
-----


Mam napisany test w tym DefaultControllerTest.php

Ten post edytował symer 27.07.2018, 09:35:55
Go to the top of the page
+Quote Post
404
post 27.07.2018, 20:51:46
Post #4





Grupa: Zarejestrowani
Postów: 226
Pomógł: 25
Dołączył: 22.05.2011

Ostrzeżenie: (0%)
-----


Pokaż tą klasę. Sprawdź też wersję PHPUnita.
Go to the top of the page
+Quote Post
symer
post 28.07.2018, 11:05:53
Post #5





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 24.08.2017

Ostrzeżenie: (0%)
-----


To jest klasa testowa co już była wbudowana w Symfony. No ale ok :
  1. namespace Tests\AppBundle\Controller;
  2.  
  3. class DefaultControllerTest
  4. {
  5. public function testIndex()
  6. {
  7. $client = static::createClient();
  8.  
  9. $crawler = $client->request('GET', '/eppend');
  10.  
  11. $this->assertEquals(200, $client->getResponse()->getStatusCode());
  12. $this->assertContains('Welcome to Symfonye', $crawler->filter('#container h1')->text());
  13. }
  14. }


A phpunit.xml
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <!-- <a href="https://phpunit.de/manual/current/en/appendixes.configuration.html" target="_blank">https://phpunit.de/manual/current/en/append...figuration.html</a> -->
  4. <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
  6. backupGlobals="false"
  7. colors="true"
  8. bootstrap="vendor/autoload.php"
  9. >
  10. <php>
  11. <ini name="error_reporting" value="-1" />
  12. <server name="KERNEL_CLASS" value="AppKernel" />
  13. </php>
  14.  
  15. <testsuites>
  16. <testsuite name="Project Test Suite">
  17. <directory>tests</directory>
  18. </testsuite>
  19. </testsuites>
  20.  
  21. <filter>
  22. <whitelist>
  23. <directory>src</directory>
  24. <exclude>
  25. <directory>src/*Bundle/Resources</directory>
  26. <directory>src/*/*Bundle/Resources</directory>
  27. <directory>src/*/Bundle/*Bundle/Resources</directory>
  28. </exclude>
  29. </whitelist>
  30. </filter>
  31. </phpunit>


Gdy dodam/edytuję klasę z tymi wierszami:
  1. use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  2.  
  3. class DefaultControllerTest extends WebTestCase


To znów pokaże mi się komunikat :

C:\xampp\htdocs\heroku\mototest3>phpunit tests\AppBundle\Controller\DefaultContr
ollerTest.php
PHP Fatal error: Class 'PHPUnit\Framework\TestCase' not found in C:\xampp\htdoc
s\heroku\mototest3\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Tes
t\KernelTestCase.php on line 25

Fatal error: Class 'PHPUnit\Framework\TestCase' not found in C:\xampp\htdocs\her
oku\mototest3\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Test\Ker
nelTestCase.php on line 25

I za cholerę nie mogę tego naprawić. Może wersja phpunit nie ta. Mam wersje symfony 3.3

Ten post edytował symer 28.07.2018, 11:03:27
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 16.04.2024 - 22:05