File tree 5 files changed +20
-14
lines changed
5 files changed +20
-14
lines changed Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
- <phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" bootstrap =" vendor/autoload.php" backupGlobals =" false" backupStaticAttributes = " false " colors =" true" verbose = " true " convertErrorsToExceptions = " true " convertNoticesToExceptions = " true " convertWarningsToExceptions = " true " processIsolation =" false" stopOnFailure =" false" xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/9.3 /phpunit.xsd" >
2
+ <phpunit xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" bootstrap =" vendor/autoload.php" backupGlobals =" false" colors =" true" processIsolation =" false" stopOnFailure =" false" xsi : noNamespaceSchemaLocation =" https://schema.phpunit.de/11.5 /phpunit.xsd" cacheDirectory = " .phpunit.cache " backupStaticProperties = " false " >
3
3
<coverage >
4
- <include >
5
- <directory suffix =" .php" >src/</directory >
6
- </include >
7
4
<report >
8
5
<clover outputFile =" build/logs/clover.xml" />
9
6
<html outputDirectory =" build/coverage" lowUpperBound =" 35" highLowerBound =" 70" />
18
15
<logging >
19
16
<junit outputFile =" build/report.junit.xml" />
20
17
</logging >
18
+ <source >
19
+ <include >
20
+ <directory suffix =" .php" >src/</directory >
21
+ </include >
22
+ </source >
21
23
</phpunit >
Original file line number Diff line number Diff line change 3
3
namespace OpenFoodFacts \Laravel \Tests ;
4
4
5
5
use OpenFoodFacts \Laravel \Facades \OpenFoodFacts ;
6
+ use PHPUnit \Framework \Attributes \Test ;
6
7
7
8
class BarcodeFindTest extends Base \FacadeTestCase
8
9
{
9
- /** @test */
10
+ #[Test]
10
11
public function it_returns_an_array_with_data_when_product_found (): void
11
12
{
12
13
$ arr = OpenFoodFacts::barcode ('0737628064502 ' );
13
14
$ this ->assertArrayHasKey ('code ' , $ arr );
14
15
}
15
16
16
- /** @test */
17
+ #[Test]
17
18
public function it_returns_an_empty_array_when_product_not_found (): void
18
19
{
19
20
$ arr = OpenFoodFacts::barcode ('this-barcode-does-not-exist ' );
20
21
21
22
$ this ->assertEquals ([], $ arr );
22
23
}
23
24
24
- /** @test */
25
+ #[Test]
25
26
public function it_throws_an_exception_when_argument_empty (): void
26
27
{
27
28
$ this ->expectException ('InvalidArgumentException ' );
Original file line number Diff line number Diff line change 4
4
5
5
use OpenFoodFacts \Document ;
6
6
use OpenFoodFacts \Laravel \Facades \OpenFoodFacts ;
7
+ use PHPUnit \Framework \Attributes \Test ;
7
8
8
9
class FacadeBridgeToApiTest extends Base \FacadeTestCase
9
10
{
10
- /** @test */
11
+ #[Test]
11
12
public function it_calls_method_on_vendor_apiclass (): void
12
13
{
13
14
$ doc = OpenFoodFacts::getProduct ('0737628064502 ' );
Original file line number Diff line number Diff line change 5
5
use Illuminate \Support \Facades \Config ;
6
6
use OpenFoodFacts \Laravel \Facades \OpenFoodFacts as OpenFoodFactsFacade ;
7
7
use OpenFoodFacts \Laravel \OpenFoodFacts ;
8
+ use PHPUnit \Framework \Attributes \Test ;
8
9
9
10
class GeographyTest extends Base \FacadeTestCase
10
11
{
11
- /** @test */
12
+ #[Test]
12
13
public function it_returns_different_content_based_on_geography_parameter (): void
13
14
{
14
15
$ barcode = '8714200216964 ' ;
@@ -23,7 +24,7 @@ public function it_returns_different_content_based_on_geography_parameter(): voi
23
24
$ this ->assertNotEquals ($ product_default_content , $ product_dutch_content );
24
25
}
25
26
26
- /** @test */
27
+ #[Test]
27
28
public function it_returns_geo_specific_content_through_config_setting (): void
28
29
{
29
30
Config::set ('openfoodfacts.geography ' , 'nl ' );
Original file line number Diff line number Diff line change 3
3
namespace OpenFoodFacts \Laravel \Tests ;
4
4
5
5
use OpenFoodFacts \Laravel \Facades \OpenFoodFacts ;
6
+ use PHPUnit \Framework \Attributes \Test ;
6
7
7
8
class ProductSearchTest extends Base \FacadeTestCase
8
9
{
9
- /** @test */
10
+ #[Test]
10
11
public function it_returns_a_laravelcollection_with_arrays (): void
11
12
{
12
13
$ results = OpenFoodFacts::find ('Stir-Fry Rice Noodles ' );
@@ -20,7 +21,7 @@ public function it_returns_a_laravelcollection_with_arrays(): void
20
21
});
21
22
}
22
23
23
- /** @test */
24
+ #[Test]
24
25
public function it_returns_an_empty_laravelcollection_when_no_results_found (): void
25
26
{
26
27
$ results = OpenFoodFacts::find ('no-such-product-exists ' );
@@ -30,15 +31,15 @@ public function it_returns_an_empty_laravelcollection_when_no_results_found(): v
30
31
$ this ->assertEquals (true , $ results ->isEmpty ());
31
32
}
32
33
33
- /** @test */
34
+ #[Test]
34
35
public function it_throws_an_exception_on_too_many_results (): void
35
36
{
36
37
$ this ->expectException ('Exception ' );
37
38
38
39
OpenFoodFacts::find ('cola ' );
39
40
}
40
41
41
- /** @test */
42
+ #[Test]
42
43
public function it_throws_an_exception_when_argument_empty (): void
43
44
{
44
45
$ this ->expectException ('InvalidArgumentException ' );
You can’t perform that action at this time.
0 commit comments