Issues (18)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

tests/Test/AbstractSitemapServiceTestCaseTest.php (5 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * (c) Christian Gripp <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Core23\SitemapBundle\Tests\Test;
11
12
use Core23\SitemapBundle\Definition\SitemapDefinitionInterface;
13
use Core23\SitemapBundle\Model\Url;
14
use Core23\SitemapBundle\Sitemap\SitemapServiceInterface;
15
use Core23\SitemapBundle\Test\AbstractSitemapServiceTestCase as ParentTestCase;
16
use DateTime;
17
use PHPUnit\Framework\AssertionFailedError;
18
19
final class AbstractSitemapServiceTestCaseTest extends ParentTestCase
20
{
21
    private $serviceMock;
22
23
    protected function setUp(): void
24
    {
25
        $this->serviceMock = $this->prophesize(SitemapServiceInterface::class);
26
27
        parent::setUp();
28
    }
29
30 View Code Duplication
    public function testAssertSitemapCount(): void
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32
        $this->expectException(AssertionFailedError::class);
33
        $this->expectExceptionMessage('Failed asserting that actual size 2 matches expected size 1.');
34
35
        $sitemap = $this->prophesize(SitemapDefinitionInterface::class);
36
37
        $this->serviceMock->execute($sitemap)
38
            ->willReturn([
39
                new Url('/path/foo', 20, Url::FREQUENCE_DAILY),
40
                new Url('/path/bar', 20, Url::FREQUENCE_DAILY),
41
            ])
42
        ;
43
44
        $this->assertSitemap('/path/bar', 20, Url::FREQUENCE_DAILY);
45
46
        $this->process($sitemap->reveal());
47
    }
48
49 View Code Duplication
    public function testAssertUrlNotCalled(): void
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
50
    {
51
        $this->expectException(AssertionFailedError::class);
52
        $this->expectExceptionMessage("The url '/path/foo' was not expected to be called.");
53
54
        $sitemap = $this->prophesize(SitemapDefinitionInterface::class);
55
56
        $this->serviceMock->execute($sitemap)
57
            ->willReturn(
58
                [
59
                    new Url('/path/foo', 20, Url::FREQUENCE_DAILY),
60
                ]
61
            )
62
        ;
63
64
        $this->assertSitemap('/path/bar', 20, Url::FREQUENCE_DAILY);
65
66
        $this->process($sitemap->reveal());
67
    }
68
69 View Code Duplication
    public function testAssertLastmod(): void
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
70
    {
71
        $this->expectException(AssertionFailedError::class);
72
        $this->expectExceptionMessage("The url '/path/foo' was expected with a different lastmod.");
73
74
        $sitemap = $this->prophesize(SitemapDefinitionInterface::class);
75
76
        $this->serviceMock->execute($sitemap)
77
            ->willReturn([
78
                new Url('/path/foo', 20, Url::FREQUENCE_DAILY, new DateTime('2018-10-02')),
79
            ])
80
        ;
81
82
        $this->assertSitemap('/path/foo', 20, Url::FREQUENCE_DAILY, new DateTime('2018-10-01'));
83
84
        $this->process($sitemap->reveal());
85
    }
86
87 View Code Duplication
    public function testAssertPriority(): void
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
88
    {
89
        $this->expectException(AssertionFailedError::class);
90
        $this->expectExceptionMessage("The url '/path/foo' was expected with 20 priority. 60 given.");
91
92
        $sitemap = $this->prophesize(SitemapDefinitionInterface::class);
93
94
        $this->serviceMock->execute($sitemap)
95
            ->willReturn([
96
                new Url('/path/foo', 60, Url::FREQUENCE_DAILY),
97
            ])
98
        ;
99
100
        $this->assertSitemap('/path/foo', 20, Url::FREQUENCE_DAILY);
101
102
        $this->process($sitemap->reveal());
103
    }
104
105 View Code Duplication
    public function testAssertChangeFreq(): void
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
106
    {
107
        $this->expectException(AssertionFailedError::class);
108
        $this->expectExceptionMessage("The url '/path/foo' was expected with weekly changefreq. daily given.");
109
110
        $sitemap = $this->prophesize(SitemapDefinitionInterface::class);
111
112
        $this->serviceMock->execute($sitemap)
113
            ->willReturn([
114
                new Url('/path/foo', 20, Url::FREQUENCE_DAILY),
115
            ])
116
        ;
117
118
        $this->assertSitemap('/path/foo', 20, Url::FREQUENCE_WEEKLY);
119
120
        $this->process($sitemap->reveal());
121
    }
122
123
    protected function createService(): SitemapServiceInterface
124
    {
125
        return $this->serviceMock->reveal();
126
    }
127
}
128