Passed
Push — master ( a42a93...58cc2a )
by Aimeos
05:58
created

StandardTest::testGetUrlsFilemtimeException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Aimeos\MW\Jsb2\Standard;
4
5
6
/**
7
 * Test class for \Aimeos\MW\Jsb2\Standard.
8
 *
9
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
10
 * @copyright Metaways Infosystems GmbH, 2011
11
 * @copyright Aimeos (aimeos.org), 2015-2024
12
 */
13
class StandardTest extends \PHPUnit\Framework\TestCase
14
{
15
	private $object;
16
	private $manifestPath;
17
18
19
	protected function setUp() : void
20
	{
21
		$ds = DIRECTORY_SEPARATOR;
22
		$this->manifestPath = __DIR__ . $ds . 'manifests' . $ds;
23
		$this->object = new \Aimeos\MW\Jsb2\Standard( $this->manifestPath . 'manifest.jsb2' );
24
	}
25
26
27
	public function testConstructNoIncludeFilesExceptions()
28
	{
29
		$this->expectException( '\Aimeos\MW\Jsb2\Exception' );
30
		$this->object = new \Aimeos\MW\Jsb2\Standard( $this->manifestPath . 'manifest_invalid_fileinclude.jsb2' );
31
	}
32
33
34
	public function testConstructNoPackageExceptions()
35
	{
36
		$this->expectException( '\Aimeos\MW\Jsb2\Exception' );
37
		$this->object = new \Aimeos\MW\Jsb2\Standard( $this->manifestPath . 'manifest_invalid_package.jsb2' );
38
	}
39
40
41
	public function testConstructInvalidPackageContentExceptions()
42
	{
43
		$this->expectException( '\Aimeos\MW\Jsb2\Exception' );
44
		$this->object = new \Aimeos\MW\Jsb2\Standard( $this->manifestPath . 'manifest_invalid_package_content.jsb2' );
45
	}
46
47
48
	public function testConstructNotJSONExceptions()
49
	{
50
		$this->expectException( '\Aimeos\MW\Jsb2\Exception' );
51
		$this->object = new \Aimeos\MW\Jsb2\Standard( $this->manifestPath . 'manifest_no_json.jsb2' );
52
	}
53
54
55
	public function testConstructFileNotExistingExceptions()
56
	{
57
		$this->expectException( '\Aimeos\MW\Jsb2\Exception' );
58
		$this->object = new \Aimeos\MW\Jsb2\Standard( $this->manifestPath . 'manifest_not_existing.jsb2' );
59
	}
60
61
62
	public function testGetFiles()
63
	{
64
		$files = $this->object->getFiles( 'jsb2-test.js' );
65
66
		$this->assertEquals( 1, count( $files ) );
67
		$this->assertStringContainsString( 'test.js', $files[0] );
68
	}
69
}
70